├── PROFILE.md
├── .gitignore
├── LICENSE
├── .github
├── steps
│ ├── x-review.md
│ ├── 4-merge-your-pull-request.md
│ ├── 3-open-a-pull-request.md
│ ├── 2-commit-a-file.md
│ └── 1-create-a-branch.md
└── workflows
│ ├── 0-start-exercise.yml
│ ├── 4-merge-your-pull-request.yml
│ ├── 1-create-a-branch.yml
│ ├── 2-commit-a-file.yml
│ └── 3-open-a-pull-request.yml
└── README.md
/PROFILE.md:
--------------------------------------------------------------------------------
1 | Welcome to my GitHub profile!
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled source #
2 | ###################
3 | *.com
4 | *.class
5 | *.dll
6 | *.exe
7 | *.o
8 | *.so
9 |
10 | # Packages #
11 | ############
12 | # it's better to unpack these files and commit the raw source
13 | # git has its own built in compression methods
14 | *.7z
15 | *.dmg
16 | *.gz
17 | *.iso
18 | *.jar
19 | *.rar
20 | *.tar
21 | *.zip
22 |
23 | # Logs and databases #
24 | ######################
25 | *.log
26 | *.sql
27 | *.sqlite
28 |
29 | # OS generated files #
30 | ######################
31 | .DS_Store
32 | .DS_Store?
33 | ._*
34 | .Spotlight-V100
35 | .Trashes
36 | ehthumbs.db
37 | Thumbs.db
38 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) GitHub, Inc.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/.github/steps/x-review.md:
--------------------------------------------------------------------------------
1 | ## Review
2 |
3 | _Congratulations, you've completed this Exercise and joined the world of developers!_
4 |
5 |
6 |
7 | Here's a recap of your accomplishments:
8 |
9 | - You learned about GitHub, repositories, branches, commits, and pull requests.
10 | - You created a branch, a commit, and a pull request.
11 | - You merged a pull request.
12 | - You made your first contribution! :tada:
13 |
14 | ### What's next?
15 |
16 | If you'd like to make a profile README, use the quickstart instructions below or follow the instructions in the [Managing your profile README](https://docs.github.com/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme) article.
17 |
18 | 1. Make a new public repository with a name that matches your GitHub username.
19 | 2. Create a file named `README.md` in its root. The "root" means not inside any folder in your repository.
20 | 3. Edit the contents of the `README.md` file.
21 | 4. If you created a new branch for your file, open and merge a pull request on your branch.
22 | 5. Lastly, we'd love to hear what you thought of this exercise [in our discussion board](https://github.com/orgs/skills/discussions/categories/introduction-to-github).
23 |
24 | Check out these resources to learn more or get involved:
25 |
26 | - Are you a student? Check out the [Student Developer Pack](https://education.github.com/pack).
27 | - [Take another GitHub Skills exercise](https://skills.github.com).
28 | - [Read the GitHub Getting Started docs](https://docs.github.com/en/get-started).
29 | - To find projects to contribute to, check out [GitHub Explore](https://github.com/explore).
30 |
--------------------------------------------------------------------------------
/.github/steps/4-merge-your-pull-request.md:
--------------------------------------------------------------------------------
1 | ## Step 4: Merge your pull request
2 |
3 | _Nicely done! :sunglasses:_
4 |
5 | You successfully created a pull request. Now it's time to merge it!
6 |
7 | **What is a merge?**: A _[merge](https://docs.github.com/en/get-started/quickstart/github-glossary#merge)_ adds the changes in your pull request and branch into the `main` branch. For more information about merges, see "[Merging a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)."
8 |
9 | 
10 |
11 | ### :keyboard: Activity: Merge the pull request
12 |
13 | 1. Click **Merge pull request**.
14 |
15 | > **Note:** You may see workflows running on your new pull request, causing the merge button to be inactive. Just wait a moment for them to finish and the merge button will activate.
16 |
17 | 2. Click **Confirm merge**.
18 |
19 | > **Tip:** Did you notice this dialog looks similar to adding a file? A merge is also a kind of commit!
20 |
21 | 3. Once your branch has been merged, you don't need it anymore. To delete this branch, click **Delete branch**.
22 |
23 | 
24 |
25 | 4. Now that your work is merged, Mona will confirm and share some final review content. Nice work! 🎉
26 |
27 |
28 | Having trouble? 🤷
29 |
30 | If you don't get feedback, here are some things to check:
31 | - Make sure you completed the previous lessons. If they haven't passed, the merge button will be gray.
32 |
33 |
--------------------------------------------------------------------------------
/.github/workflows/0-start-exercise.yml:
--------------------------------------------------------------------------------
1 | name: Step 0 # Start Exercise
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 |
8 | permissions:
9 | contents: write # Update Readme
10 | actions: write # Disable/enable workflows
11 | issues: write # Create issue and comment on issues
12 |
13 |
14 | env:
15 | STEP_1_FILE: ".github/steps/1-create-a-branch.md"
16 |
17 | jobs:
18 | start_exercise:
19 | if: |
20 | !github.event.repository.is_template
21 | name: Start Exercise
22 | uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.1.0
23 | with:
24 | exercise-title: "Introduction to GitHub"
25 | intro-message: "If you are new to GitHub, you might find your fellow developers use ___**issues**___ to organize their work and collaborate. We will do the same! That's another lesson, but today, we will introduce you to the basics."
26 |
27 |
28 | post_next_step_content:
29 | name: Post next step content
30 | runs-on: ubuntu-latest
31 | needs: [start_exercise]
32 | env:
33 | ISSUE_URL: ${{ needs.start_exercise.outputs.issue-url }}
34 |
35 | steps:
36 | - name: Checkout
37 | uses: actions/checkout@v4
38 |
39 | - name: Get response templates
40 | uses: actions/checkout@v4
41 | with:
42 | repository: skills/exercise-toolkit
43 | path: exercise-toolkit
44 | ref: v0.1.0
45 |
46 | - name: Create comment - add step content
47 | run: |
48 | gh issue comment "$ISSUE_URL" \
49 | --body-file ${{ env.STEP_1_FILE }}
50 | env:
51 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 |
53 | - name: Create comment - watching for progress
54 | run: |
55 | gh issue comment "$ISSUE_URL" \
56 | --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
57 | env:
58 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 |
60 | - name: Disable current workflow and enable next one
61 | run: |
62 | gh workflow enable "Step 1"
63 | env:
64 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 |
--------------------------------------------------------------------------------
/.github/steps/3-open-a-pull-request.md:
--------------------------------------------------------------------------------
1 | ## Step 3: Open a pull request
2 |
3 | _Nice work making that commit! :sparkles:_
4 |
5 | Now that you have made a change to the project and created a commit, it’s time to share your proposed change through a pull request!
6 |
7 | **What is a pull request?**: Collaboration happens on a _[pull request](https://docs.github.com/en/get-started/quickstart/github-glossary#pull-request)_. The pull request shows the changes in your branch to other people and allows people to accept, reject, or suggest additional changes to your branch. In a side by side comparison, this pull request is going to keep the changes you just made on your branch and propose applying them to the `main` project branch. For more information about pull requests, see "[About pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)".
8 |
9 | ### :keyboard: Activity: Create a pull request
10 |
11 | You may have noticed after your commit that a message displayed indicating your recent push to your branch and providing a button that says **Compare & pull request**.
12 |
13 | 
14 |
15 | To create a pull request automatically, click **Compare & pull request** button, and then skip to step 5 below. Alternately, you practice creating it manually using the first 4 steps.
16 |
17 | 1. In the header menu of your repository, click the **Pull requests** tab .
18 | 2. Click the **New pull request** button.
19 | 3. Select the following branches using the dropdown menus.
20 |
21 | - **base:** `main`
22 | - **compare:** `my-first-branch`
23 |
24 | 
25 |
26 | 4. Click **Create pull request**.
27 |
28 | 5. Enter a title for your pull request. By default, the title will automatically be the name of your branch. For this exercise, let's edit the field to say `Add my first file`.
29 |
30 | 6. The next field helps you provide a **description** of the changes you made. Please enter a short description of what you’ve accomplished so far. As a reminder, you have: created a new branch, created a file, and made a commit.
31 |
32 | 
33 |
34 | 7. Click **Create pull request**.
35 |
36 | 8. Now that you've started a place to collaborate, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson.
37 |
38 |
39 |
40 | Having trouble? 🤷
41 |
42 | If you don't get feedback, here are some things to check:
43 | - Make sure your pull request title is correct.
44 | - Ensure your pull request has a description.
45 |
46 |
--------------------------------------------------------------------------------
/.github/workflows/4-merge-your-pull-request.yml:
--------------------------------------------------------------------------------
1 | name: Step 4 # Merge your pull request
2 |
3 | # Checks if the learner completed tasks for step 4.
4 | # - Triggers when the user merges the pull request.
5 | # - If all checks pass, the workflow is disabled so it doesn't run again. As such, workflow status badge will change to green.
6 |
7 | on:
8 | pull_request:
9 | branches:
10 | - main
11 | types:
12 | - closed
13 |
14 | permissions:
15 | contents: write
16 | actions: write
17 | issues: write
18 |
19 | env:
20 | REVIEW_FILE: ".github/steps/x-review.md"
21 |
22 | jobs:
23 | find_exercise:
24 | name: Find Exercise Issue
25 | uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.1.0
26 |
27 | check_step_work:
28 | name: Check step work
29 | needs: find_exercise
30 | runs-on: ubuntu-latest
31 | if: |
32 | !github.event.repository.is_template &&
33 | github.head_ref == 'my-first-branch' &&
34 | github.event.pull_request.merged == true
35 | env:
36 | ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
37 |
38 | steps:
39 | - name: Get response templates
40 | uses: actions/checkout@v4
41 | with:
42 | repository: skills/exercise-toolkit
43 | path: exercise-toolkit
44 | ref: v0.1.0
45 |
46 | - name: Nothing to check
47 | run: echo "The workflow was triggered, so it passes."
48 |
49 | - name: Update comment - step finished - final review next
50 | run: |
51 | gh issue comment "$ISSUE_URL" \
52 | --body-file exercise-toolkit/markdown-templates/step-feedback/lesson-review.md \
53 | --edit-last
54 | env:
55 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56 |
57 | post_review_content:
58 | name: Post review content
59 | needs: [find_exercise, check_step_work]
60 | runs-on: ubuntu-latest
61 | if: |
62 | !github.event.repository.is_template
63 | env:
64 | ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
65 |
66 | steps:
67 | - name: Checkout
68 | uses: actions/checkout@v4
69 |
70 | - name: Create comment - add review content
71 | run: |
72 | gh issue comment "$ISSUE_URL" \
73 | --body-file ${{ env.REVIEW_FILE }}
74 | env:
75 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76 |
77 | finish_exercise:
78 | name: Finish Exercise
79 | needs: [find_exercise, post_review_content]
80 | uses: skills/exercise-toolkit/.github/workflows/finish-exercise.yml@v0.1.0
81 | with:
82 | issue-url: ${{ needs.find_exercise.outputs.issue-url }}
83 |
84 |
85 | disable_workflow:
86 | name: Disable this workflow
87 | needs: [find_exercise, post_review_content]
88 | runs-on: ubuntu-latest
89 |
90 | steps:
91 | - name: Checkout
92 | uses: actions/checkout@v4
93 | - name: Disable current workflow
94 | run: gh workflow disable "${{github.workflow}}"
95 | env:
96 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97 |
98 |
--------------------------------------------------------------------------------
/.github/steps/2-commit-a-file.md:
--------------------------------------------------------------------------------
1 | ## Step 2: Commit a file
2 |
3 | _You created a branch! :tada:_
4 |
5 | Creating a branch allows you to edit your project without changing the `main` branch. Now that you have a branch, it’s time to create a file and make your first commit!
6 |
7 | **What is a commit?**: A _[commit](https://docs.github.com/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits)_ is a set of changes to the files and folders in your project. A commit exists in a branch. For more information, see "[About commits](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits)".
8 |
9 | ### :keyboard: Activity: Your first commit
10 |
11 | The following steps will guide you through the process of committing a change on GitHub. A commit records changes to the project such as adding/removing/renaming files and modifying file content. For this exercise, committing a change will be adding a new file to your new branch.
12 |
13 | > [!NOTE]
14 | > `.md` is a file extension that creates a Markdown file. You can learn more about Markdown by visiting "[Basic writing and formatting syntax](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax)" in our docs or by taking the "[Communicating using Markdown](https://github.com/skills/communicate-using-markdown)" Skills Exercise.
15 |
16 | 1. On the **< > Code** tab in the header menu of your repository, make sure you're on your new branch `my-first-branch`.
17 |
18 | 2. Select the **Add file** drop-down and click **Create new file**.
19 |
20 |
21 |
22 | 3. In the **Name your file...** field, enter `PROFILE.md`.
23 |
24 | 4. In the **Enter file contents here** area, copy the following content to your file:
25 |
26 | ```
27 | Welcome to my GitHub profile!
28 | ```
29 |
30 | 
31 |
32 | 5. Click **Commit changes...** in the upper right corner above the contents box. A dialog will appear.
33 |
34 | 6. GitHub offers a simple default message, but let's change it slightly for practice. Enter `Add PROFILE.md` in the **Commit message** field.
35 |
36 | - A **commit message** and optional **extended description** help provide clarity for your changes. This is particularly useful when your commit involves several files.
37 |
38 |
39 |
40 | 6. In this lesson, we'll ignore the other fields for now and click **Commit changes**.
41 |
42 | 7. Now that you've changed a file, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson.
43 |
44 |
45 |
46 | Having trouble? 🤷
47 |
48 | If you don't get feedback, here are some things to check:
49 | - Make sure you are on the `my-first-branch` branch.
50 | - Ensure the `PROFILE.md` file is created and in the root folder.
51 |
52 |
53 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ⭐️ Congratulations salimi-my! ⭐️
4 |
5 | You completed this exercise! Nice work! 🥳
6 |
7 | If you would like to practice again, you can retrace your steps below. Just press the **Start Exercise** button again.
8 |
9 | > [!TIP]
10 | > Mona won't grade you this time! 😉
11 |
12 |
13 | # Introduction to GitHub
14 |
15 | _Get started using GitHub in less than an hour._
16 |
17 | ## Welcome
18 |
19 | People use GitHub to build some of the most advanced technologies in the world. Whether you’re visualizing data or building a new game, there’s a whole community and set of tools on GitHub that can help you do it even better. GitHub Skills’ “Introduction to GitHub” exercise guides you through everything you need to start contributing in less than an hour.
20 |
21 | - **Who is this for**: New developers, new GitHub users, and students.
22 | - **What you'll learn**: We'll introduce repositories, branches, commits, and pull requests.
23 | - **What you'll build**: We'll make a short Markdown file you can use as your [profile README](https://docs.github.com/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme).
24 | - **Prerequisites**: None. This exercise is a great introduction for your first day on GitHub.
25 | - **How long**: This exercise takes less than one hour to complete.
26 |
27 | In this exercise, you will:
28 |
29 | 1. Create a branch
30 | 2. Commit a file
31 | 3. Open a pull request
32 | 4. Merge your pull request
33 |
34 | ### How to start this exercise
35 |
36 | 1. Right-click **Copy Exercise** and open the link in a new tab.
37 |
38 |
39 |
40 |
41 |
42 | 2. In the new tab, most of the prompts will automatically fill in for you.
43 | - For owner, choose your personal account or an organization to host the repository.
44 | - We recommend creating a public repository, as private repositories will [use Actions minutes](https://docs.github.chttps://github.com/salimi-my/skills-introduction-to-github/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
45 | - Scroll down and click the **Create repository** button at the bottom of the form.
46 |
47 | 3. After your new repository is created, wait about 20 seconds for the exercise to be prepared and buttons updated. You will continue working from your copy of the exercise.
48 | - The **Copy Exercise** button will deactivate, changing to gray.
49 | - The **Start Exercise** button will activate, changing to green.
50 | - You will likely need to refresh the page.
51 |
52 | 4. Click **Start Exercise**. Follow the step-by-step instructions and feedback will be provided as you progress.
53 |
54 |
55 |
56 |
57 |
58 | > [!IMPORTANT]
59 | > The **Start Exercise** button will activate after copying the repository. You will probably need to refresh the page.
60 |
61 | ---
62 |
63 | © 2025 GitHub • [Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.md) • [MIT License](https://gh.io/mit)
64 |
--------------------------------------------------------------------------------
/.github/workflows/1-create-a-branch.yml:
--------------------------------------------------------------------------------
1 | name: Step 1 # Create a branch
2 |
3 | # Checks if the learner completed tasks for step 1.
4 | # - Triggers when the user creates a new branch 'my-first-branch'.
5 | # - Checks that the branch name is 'my-first-branch'.
6 | # - If all checks pass, the workflow is disabled so it doesn't run again. As such, workflow status badge will change to green.
7 |
8 | on:
9 | push:
10 | branches:
11 | - "my-first-branch"
12 |
13 | permissions:
14 | contents: read
15 | actions: write
16 | issues: write
17 |
18 | env:
19 | STEP_2_FILE: ".github/steps/2-commit-a-file.md"
20 |
21 | jobs:
22 | find_exercise:
23 | name: Find Exercise Issue
24 | uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.1.0
25 |
26 | check_step_work:
27 | name: Check step work
28 | runs-on: ubuntu-latest
29 | needs: find_exercise
30 | env:
31 | ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
32 |
33 | steps:
34 |
35 | - name: Get response templates
36 | uses: actions/checkout@v4
37 | with:
38 | repository: skills/exercise-toolkit
39 | path: exercise-toolkit
40 | ref: v0.1.0
41 |
42 |
43 | - name: Update comment - checking work
44 | run: |
45 | gh issue comment "$ISSUE_URL" \
46 | --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
47 | --edit-last
48 | env:
49 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 |
51 | - name: Build message - step finished
52 | id: build-message-step-finish
53 | uses: skills/action-text-variables@v1
54 | with:
55 | template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
56 | template-vars: |
57 | next_step_number=2
58 |
59 | - name: Update comment - step finished
60 | run: |
61 | gh issue comment "$ISSUE_URL" \
62 | --body "$ISSUE_BODY" \
63 | --edit-last
64 | env:
65 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66 | ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }}
67 |
68 | post_next_step_content:
69 | name: Post next step content
70 | needs: [find_exercise, check_step_work]
71 | runs-on: ubuntu-latest
72 | env:
73 | ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
74 |
75 | steps:
76 | - name: Checkout
77 | uses: actions/checkout@v4
78 |
79 | - name: Get response templates
80 | uses: actions/checkout@v4
81 | with:
82 | repository: skills/exercise-toolkit
83 | path: exercise-toolkit
84 | ref: v0.1.0
85 |
86 | - name: Create comment - add step content
87 | run: |
88 | gh issue comment "$ISSUE_URL" \
89 | --body-file ${{ env.STEP_2_FILE }}
90 | env:
91 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92 |
93 | - name: Create comment - watching for progress
94 | run: |
95 | gh issue comment "$ISSUE_URL" \
96 | --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
97 | env:
98 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99 |
100 | - name: Disable current workflow and enable next one
101 | run: |
102 | gh workflow disable "Step 1"
103 | gh workflow enable "Step 2"
104 | env:
105 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106 |
--------------------------------------------------------------------------------
/.github/workflows/2-commit-a-file.yml:
--------------------------------------------------------------------------------
1 | name: Step 2 # Commit a file
2 |
3 | # Checks if the learner completed tasks for step 2.
4 | # - Triggers when the user makes a push to the branch 'my-first-branch' and modifies the file 'PROFILE.md'.
5 | # - If all checks pass, the workflow is disabled so it doesn't run again. As such, workflow status badge will change to green.
6 |
7 | on:
8 | push:
9 | branches:
10 | - "my-first-branch"
11 |
12 | permissions:
13 | contents: read
14 | actions: write
15 | issues: write
16 |
17 | env:
18 | STEP_3_FILE: ".github/steps/3-open-a-pull-request.md"
19 |
20 |
21 | jobs:
22 | find_exercise:
23 | name: Find Exercise Issue
24 | uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.1.0
25 |
26 | check_step_work:
27 | name: Check step work
28 | runs-on: ubuntu-latest
29 | needs: find_exercise
30 | if: |
31 | !github.event.repository.is_template
32 | env:
33 | ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
34 |
35 | steps:
36 | - name: Checkout
37 | uses: actions/checkout@v4
38 |
39 | - name: Get response templates
40 | uses: actions/checkout@v4
41 | with:
42 | repository: skills/exercise-toolkit
43 | path: exercise-toolkit
44 | ref: v0.1.0
45 |
46 |
47 | - name: Update comment - checking work
48 | run: |
49 | gh issue comment "$ISSUE_URL" \
50 | --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
51 | --edit-last
52 | env:
53 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 |
55 | # START: Check practical exercise
56 |
57 | # Nothing to verify. Creating the PROFILE.md file is enough.
58 |
59 | # END: Check practical exercise
60 |
61 |
62 | - name: Build message - step finished
63 | id: build-message-step-finish
64 | uses: skills/action-text-variables@v1
65 | with:
66 | template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
67 | template-vars: |
68 | next_step_number=3
69 |
70 | - name: Update comment - step finished
71 | run: |
72 | gh issue comment "$ISSUE_URL" \
73 | --body "${{ steps.build-message-step-finish.outputs.updated-text }}" \
74 | --edit-last
75 | env:
76 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77 |
78 | post_next_step_content:
79 | name: Post next step content
80 | needs: [find_exercise, check_step_work]
81 | runs-on: ubuntu-latest
82 | env:
83 | ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
84 |
85 | steps:
86 | - name: Checkout
87 | uses: actions/checkout@v4
88 |
89 | - name: Get response templates
90 | uses: actions/checkout@v4
91 | with:
92 | repository: skills/exercise-toolkit
93 | path: exercise-toolkit
94 | ref: v0.1.0
95 |
96 | - name: Create comment - add step content
97 | run: |
98 | gh issue comment "$ISSUE_URL" \
99 | --body-file ${{ env.STEP_3_FILE }}
100 | env:
101 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102 |
103 | - name: Create comment - watching for progress
104 | run: |
105 | gh issue comment "$ISSUE_URL" \
106 | --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
107 | env:
108 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109 |
110 | - name: Disable current workflow and enable next one
111 | run: |
112 | gh workflow disable "Step 2"
113 | gh workflow enable "Step 3"
114 | env:
115 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116 |
--------------------------------------------------------------------------------
/.github/steps/1-create-a-branch.md:
--------------------------------------------------------------------------------
1 | ## Step 1: Create a branch
2 |
3 | _Welcome to "Introduction to GitHub"! :wave:_
4 |
5 | **What is GitHub?**: GitHub is a collaboration platform that uses _[Git](https://docs.github.com/get-started/quickstart/github-glossary#git)_ for versioning.
6 | GitHub is a popular place to share and contribute to [open-source](https://docs.github.com/get-started/quickstart/github-glossary#open-source) software.
7 |
8 | :tv: [Video: What is GitHub?](https://www.youtube.com/watch?v=pBy1zgt0XPc)
9 |
10 | **What is a repository?**: A _[repository](https://docs.github.com/get-started/quickstart/github-glossary#repository)_ is a project containing files and folders.
11 | A repository tracks versions of files and folders. For more information, see
12 | "[About repositories](https://docs.github.com/en/repositories/creating-and-managing-repositories/about-repositories)" from GitHub Docs.
13 |
14 | **What is a branch?**: A _[branch](https://docs.github.com/en/get-started/quickstart/github-glossary#branch)_ is a parallel version of your repository.
15 | By default, your repository has one branch named `main` and it is considered to be the definitive branch.
16 | Creating additional branches allows you to copy the `main` branch of your repository and safely make any changes without disrupting the main project.
17 | Many people use branches to work on specific features without affecting any other parts of the project.
18 |
19 | Branches allow you to separate your work from the `main` branch.
20 | In other words, everyone's work is safe while you contribute.
21 | For more information, see "[About branches](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches)".
22 |
23 | **What is a profile README?**: A _[profile README](https://docs.github.com/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme)_
24 | is essentially an "About me" section on your GitHub profile where you can share information about yourself with the community on GitHub.com.
25 | GitHub shows your profile README at the top of your profile page. For more information, see "[Managing your profile README](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme)".
26 |
27 | 
28 |
29 | ### :keyboard: Activity: Your first branch
30 |
31 | 1. Open a new browser tab and navigate to your newly made repository (your copy of this exercise). Then, work on the steps in your second tab while you read the instructions in this tab.
32 |
33 | 2. Navigate to the **< > Code** tab in the header menu of your repository.
34 |
35 | 
36 |
37 | 3. Click on the **main** branch drop-down.
38 |
39 |
40 |
41 | 4. In the text box **Find or create a branch...**, enter `my-first-branch`.
42 |
43 | > **Note:** This is checked to continue with the next step. :wink:
44 |
45 | 5. Click the text **Create branch: `my-first-branch` from main** to create your branch.
46 |
47 |
48 |
49 | - The branch will automatically switch to the one you just created.
50 | - The **main** branch drop-down menu will display your new branch name.
51 |
52 | 6. Now that your branch is pushed to GitHub, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson.
53 |
54 |
55 |
56 | Having trouble? 🤷
57 |
58 | If you don't get feedback, here are some things to check:
59 | - Make sure your created the branch with the exact name `my-first-branch`. No prefixes or suffixes.
60 |
61 |
--------------------------------------------------------------------------------
/.github/workflows/3-open-a-pull-request.yml:
--------------------------------------------------------------------------------
1 | name: Step 3 # Open a pull request
2 |
3 | # Checks if the learner completed tasks for step 3.
4 | # - Triggers when the user creates or edits the pull request.
5 | # - Checks the pull request title and description. Adds a PR comment.
6 | # - If all checks pass, the workflow is disabled so it doesn't run again. As such, workflow status badge will change to green.
7 |
8 | on:
9 | pull_request:
10 | branches:
11 | - main
12 | types:
13 | - opened
14 | - synchronize
15 | - reopened
16 | - edited
17 |
18 | permissions:
19 | contents: read
20 | actions: write
21 | issues: write
22 |
23 | env:
24 | STEP_4_FILE: ".github/steps/4-merge-your-pull-request.md"
25 |
26 | jobs:
27 | find_exercise:
28 | name: Find Exercise Issue
29 | uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.1.0
30 |
31 | check_step_work:
32 | name: Check step work
33 | runs-on: ubuntu-latest
34 | needs: find_exercise
35 | if: |
36 | !github.event.repository.is_template &&
37 | github.head_ref == 'my-first-branch'
38 | env:
39 | ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
40 |
41 | steps:
42 | - name: Checkout
43 | uses: actions/checkout@v4
44 |
45 | - name: Get response templates
46 | uses: actions/checkout@v4
47 | with:
48 | repository: skills/exercise-toolkit
49 | path: exercise-toolkit
50 | ref: v0.1.0
51 |
52 | - name: Update comment - congratulate first PR
53 | run: |
54 | message="You've created your first pull request. Nice work! ✨🎉 Now, let's check your work."
55 | gh issue comment "$ISSUE_URL" \
56 | --body "$message" \
57 | --edit-last
58 | env:
59 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60 |
61 | - name: Check user work
62 | id: check-user-work
63 | run: |
64 | # Checks to perform
65 | checks='{
66 | "pr_title": {
67 | "name": "Pull request title",
68 | "passed": true,
69 | "message": ""
70 | },
71 | "pr_description": {
72 | "name": "Pull request description",
73 | "passed": true,
74 | "message": ""
75 | }
76 | }'
77 |
78 | # Check pull request title
79 | if [ "${{ github.event.pull_request.title }}" != "Add my first file" ]; then
80 | checks=$(echo $checks | jq '.pr_title.passed = false')
81 | checks=$(echo $checks | jq '.pr_title.message = "Incorrect title"')
82 | fi
83 |
84 | # Check if a pull request description exists
85 | if [ "${{ github.event.pull_request.body }}" == "" ]; then
86 | checks=$(echo $checks | jq '.pr_description.passed = false')
87 | checks=$(echo $checks | jq '.pr_description.message = "Empty pull request description"')
88 | fi
89 |
90 | # Verify all checks passed
91 | passed=$(echo $checks | jq '. | all(.passed?)')
92 |
93 | # Flatten to an array for returning. Allows iteration during rendering.
94 | results=$(echo $checks | jq 'to_entries | map({name: .key} + .value)')
95 |
96 | # Save pass status to output
97 | echo "passed=$passed" >> $GITHUB_OUTPUT
98 |
99 | # Save results to output
100 | echo 'results<> $GITHUB_OUTPUT
101 | echo $results >> $GITHUB_OUTPUT
102 | echo 'EOF' >> $GITHUB_OUTPUT
103 |
104 | - name: Build message - step results
105 | id: build-message-step-results
106 | uses: skills/action-text-variables@v1
107 | with:
108 | template-file: exercise-toolkit/markdown-templates/step-feedback/step-results.md
109 | template-vars: '{
110 | "step_number": 3,
111 | "passed": ${{ steps.check-user-work.outputs.passed }},
112 | "results_table": ${{ steps.check-user-work.outputs.results }},
113 | "tips": [
114 | "Issues are for capturing a problem/idea and possible solutions.",
115 | "Pull requests are for active development and getting feedback."
116 | ]
117 | }'
118 |
119 | - name: Create comment - step results
120 | run: |
121 | gh issue comment "$ISSUE_URL" \
122 | --body "${{ steps.build-message-step-results.outputs.updated-text }}" \
123 | --edit-last
124 | env:
125 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126 |
127 | - name: Fail job if not all checks passed
128 | if: steps.check-user-work.outputs.passed == 'false'
129 | run: exit 1
130 |
131 | - name: Build message - step finished
132 | id: build-message-step-finish
133 | uses: skills/action-text-variables@v1
134 | with:
135 | template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
136 | template-vars: |
137 | next_step_number=4
138 |
139 | - name: Update comment - step finished
140 | run: |
141 | gh issue comment "$ISSUE_URL" \
142 | --body "${{ steps.build-message-step-finish.outputs.updated-text }}"
143 | env:
144 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145 |
146 | post_step_4_content:
147 | name: Post step 4 content
148 | needs: [find_exercise, check_step_work]
149 | runs-on: ubuntu-latest
150 | env:
151 | ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
152 |
153 | steps:
154 | - name: Checkout
155 | uses: actions/checkout@v4
156 |
157 | - name: Get response templates
158 | uses: actions/checkout@v4
159 | with:
160 | repository: skills/exercise-toolkit
161 | path: exercise-toolkit
162 | ref: v0.1.0
163 |
164 | - name: Create comment - add step content
165 | run: |
166 | gh issue comment "$ISSUE_URL" \
167 | --body-file ${{ env.STEP_4_FILE }}
168 | env:
169 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170 |
171 | - name: Create comment - watching for progress
172 | run: |
173 | gh issue comment "$ISSUE_URL" \
174 | --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
175 | env:
176 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
177 |
178 | - name: Disable current workflow and enable next one
179 | run: |
180 | gh workflow disable "Step 3"
181 | gh workflow enable "Step 4"
182 | env:
183 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
184 |
--------------------------------------------------------------------------------