Skip to content

Commit 6455861

Browse files
Initial commit
0 parents  commit 6455861

13 files changed

+888
-0
lines changed

.github/steps/1-create-a-branch.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
![screenshot showing an example profile readme](https://github.com/user-attachments/assets/9425d1aa-04ba-459b-b89d-31fbae87c743)
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+
![screenshot highlighting the code tab](https://github.com/user-attachments/assets/8e1283ea-9cea-4a7e-8359-a7617734ff9a)
36+
37+
3. Click on the **main** branch drop-down.
38+
39+
<img width="300" alt="screenshot highlighting the branch selection" src="https://github.com/user-attachments/assets/1a07c958-cebf-4ca5-805e-22c1725635ba">
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+
<img width="300" alt="screenshot highlighting the create branch prompt" src="https://github.com/user-attachments/assets/99d19ff5-4482-4210-ae45-84e7b7c47632">
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+
<details>
56+
<summary>Having trouble? 🤷</summary><br/>
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+
</details>

.github/steps/2-commit-a-file.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
<img width="300" alt="screenshot of the create new file option" src="https://github.com/user-attachments/assets/cfb062cd-be60-4f12-948c-0946a6fe01da">
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+
![screenshot for adding the profile.md file](https://github.com/user-attachments/assets/e00540be-4334-4d0d-adc2-9893b5477a91)
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+
<img width="400" alt="screenshot of adding a new file with a commit message" src="https://github.com/user-attachments/assets/6ab299ce-8039-4734-a707-d7c3cd7077a0">
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+
<details>
46+
<summary>Having trouble? 🤷</summary><br/>
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+
</details>
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
![screenshot of message and button](https://github.com/user-attachments/assets/47b82c6e-d45b-4854-b8b4-1cb2c33af05f)
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+
![screenshot showing both branch selections](https://github.com/user-attachments/assets/140ca348-b6de-4c3c-b29f-fd57944d98a9)
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+
![screenshot showing pull request](https://github.com/user-attachments/assets/e03171f9-98cc-4067-a473-78424618f1f8)
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+
<details>
40+
<summary>Having trouble? 🤷</summary><br/>
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+
</details>
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Step 4: Merge your pull request
2+
3+
_Nicely done! :sunglasses:_
4+
5+
You successfully created a pull request. Now it's time 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+
![screenshot of green merge pull request button](https://github.com/user-attachments/assets/ce2f04cb-8a71-411f-8dc8-827a2bc23a30)
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+
![screenshot showing delete branch button](https://github.com/user-attachments/assets/0fda948e-14e0-4643-aa53-d9f9f364cddd)
24+
25+
4. Now that your work is merged, Mona will confirm and share some final review content. Nice work! 🎉
26+
27+
<details>
28+
<summary>Having trouble? 🤷</summary><br/>
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+
</details>

.github/steps/x-review.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Review
2+
3+
_Congratulations, you've completed this Exercise and joined the world of developers!_
4+
5+
<img src=https://octodex.github.com/images/collabocats.jpg alt=celebrate width=300 align=right>
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).
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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/[email protected]
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 }}
+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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/[email protected]
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 }}

0 commit comments

Comments
 (0)