Skip to content

Commit 8c1fc29

Browse files
authored
Update course format for accessibility (skills#18)
* Update course format for accessibility * outline step files * More automatic fixes * Manual fixes * manual fixes * manual fixes * manual fixes
1 parent e78a2e2 commit 8c1fc29

13 files changed

+238
-263
lines changed
File renamed without changes.

.github/steps/0-welcome.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- readme -->

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!--
2+
<<< Author notes: Step 1 >>>
3+
Choose 3-5 steps for your course.
4+
The first step is always the hardest, so pick something easy!
5+
Link to docs.github.com for further explanations.
6+
Encourage users to open new tabs for steps!
7+
-->
8+
9+
## Step 1: Create a pull request
10+
11+
_Welcome to "Managing Merge Conflicts"! :wave:_
12+
13+
**What is a _merge conflict_?**: A **merge conflict** occurs when changes are made to the same part of the same file on two different branches. You usually find out about conflicts in a pull request so let's start by creating one.
14+
15+
### :keyboard: Activity: Create a pull request
16+
17+
1. Open a new browser tab, and work on the steps in your second tab while you read the instructions in this tab.
18+
1. We made a small change to a file in the repository in the `my-resume` branch.
19+
1. [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) setting `my-resume` as the head branch and `main` as the base branch. You can enter `Resolving merge conflicts` for the pull request title and body.
20+
1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
<<< Author notes: Step 2 >>>
3+
Start this step by acknowledging the previous step.
4+
Define terms and link to docs.github.com.
5+
-->
6+
7+
## Step 2: Resolve a merge conflict
8+
9+
_Good start! Now let's look deeper at a merge conflict! :mag:_
10+
11+
This can be intimidating, but have no fear, Git is smart when it comes to merging! Git only needs a human to decide how to [resolve the conflict](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line). Sometimes, the best way to resolve a merge conflict is to add content that's from both branches, or even something that isn't on either! This is why Git needs a human to look at the code and make the proper fixes.
12+
13+
### :keyboard: Activity: Resolve a merge conflict
14+
15+
1. Open the pull request that you just created, we created a conflict for you. Have no fear!
16+
1. At the bottom of the page, under "This branch has conflicts that must be resolved", click the **Resolve conflicts** button.
17+
1. Look for the highlighted sections that begins with `<<<<<<< my-resume` and ends with `>>>>>>> main`. These markers are added by Git to show you the content that is in conflict.
18+
1. Remove the changes made on the main branch by deleting all of the content below the `=======` and above `>>>>>>> main`.
19+
1. Next, remove the merge conflict markers by deleting the following lines:
20+
```
21+
<<<<<<< my-resume
22+
=======
23+
>>>>>>> main
24+
```
25+
1. With the merge conflict markers removed, click **Mark as resolved**.
26+
1. Finally, click **Commit merge**.
27+
1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!--
2+
<<< Author notes: Step 3 >>>
3+
Start this step by acknowledging the previous step.
4+
Define terms and link to docs.github.com.
5+
-->
6+
7+
## Step 3: Create your own conflict
8+
9+
_Good job! You've solved a merge conflict! :tada:_
10+
11+
Resolving a conflict doesn't automatically merge the pull request in GitHub. Instead, it stores the resolution of the conflict in a merge commit and allows you and your team to keep working. To resolve a conflict, GitHub performs what is known as a _reverse merge_. This means that the changes from the `main` branch were merged into your `my-resume` branch. With a reverse merge, only the `my-resume` branch is updated. This allows you to test the resolved changes on your branch before you merge it into `main`.
12+
13+
Now, let's get a little evil. (It's for educational purposes!)
14+
15+
### :keyboard: Activity: Create your own conflict
16+
17+
We went ahead and added a new file called `references.md` and pushed that change to `main`, without updating your `my-resume` branch.
18+
19+
1. Browse to the `my-resume` branch.
20+
1. Click the `Add file` dropdown menu and then on `Create new file`.
21+
1. Create a file named `references.md`.
22+
1. Enter some text that conflicts with what we added for `references.md` in the `main` branch.
23+
1. Scroll to the bottom of the page and enter a commit message for your change.
24+
1. Click the **Commit new file** button, making sure the "Commit directly to the `my-resume` branch" option is selected.
25+
1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
<<< Author notes: Step 4 >>>
3+
Start this step by acknowledging the previous step.
4+
Define terms and link to docs.github.com.
5+
-->
6+
7+
## Step 4: Merge your pull request
8+
9+
_Almost there! :heart:_
10+
11+
You can now [merge](https://docs.github.com/en/get-started/quickstart/github-glossary#merge) your pull request!
12+
13+
### :keyboard: Activity: Merge your pull request
14+
15+
1. First, resolve any remaining conflicts in your pull request.
16+
> Look back at step one if you need help.
17+
1. Click **Merge pull request**.
18+
1. Delete the branch `my-resume` (optional).
19+
1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.

.github/steps/X-finish.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
<<< Author notes: Finish >>>
3+
Review what we learned, ask for feedback, provide next steps.
4+
-->
5+
6+
## Finish
7+
8+
_Congratulations friend, you've completed this course!_
9+
10+
<img src=https://octodex.github.com/images/benevocats.jpg alt=celebrate width=300 align=right>
11+
12+
Here's a recap of all the tasks you've accomplished in your repository:
13+
14+
- You learned why merge conflicts happen.
15+
- You resolved a simple merge conflict.
16+
- You created a merge conflict, and resolved it!
17+
18+
### What's next?
19+
20+
- Make your own Markdown resume site with GitHub Pages! Learn how in our [GitHub Pages](https://github.com/skills/github-pages) course.
21+
- We'd love to hear what you thought of this course [in our discussion board](https://github.com/skills/.github/discussions).
22+
- [Take another GitHub Skills course](https://github.com/skills).
23+
- [Read the GitHub Getting Started docs](https://docs.github.com/en/get-started).
24+
- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore).

.github/workflows/0-start.yml renamed to .github/workflows/0-welcome.yml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1-
name: Step 0, Start
1+
name: Step 0, Welcome
22

3-
# This step triggers after the learner creates a new repository from the template
4-
# This step sets STEP to 1
5-
# This step closes <details id=0> and opens <details id=1>
3+
# This step triggers after the learner creates a new repository from the template.
4+
# This workflow updates from step 0 to step 1.
65

7-
# This will run every time we create push a commit to `main`
8-
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
6+
# This will run every time we create push a commit to `main`.
7+
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
98
on:
109
workflow_dispatch:
1110
push:
1211
branches:
1312
- main
1413

15-
# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
14+
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
1615
permissions:
17-
# Need `contents: read` to checkout the repository
18-
# Need `contents: write` to update the step metadata
16+
# Need `contents: read` to checkout the repository.
17+
# Need `contents: write` to update the step metadata.
1918
contents: write
2019

2120
jobs:
22-
# Get the current step from .github/script/STEP so we can
23-
# limit running the main job when the learner is on the same step.
21+
# Get the current step to only run the main job when the learner is on the same step.
2422
get_current_step:
2523
name: Check current step number
2624
runs-on: ubuntu-latest
@@ -29,7 +27,7 @@ jobs:
2927
uses: actions/checkout@v3
3028
- id: get_step
3129
run: |
32-
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
30+
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
3331
outputs:
3432
current_step: ${{ steps.get_step.outputs.current_step }}
3533

@@ -38,28 +36,28 @@ jobs:
3836
needs: get_current_step
3937

4038
# We will only run this action when:
41-
# 1. This repository isn't the template repository
42-
# 2. The STEP is currently 0
43-
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
44-
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
39+
# 1. This repository isn't the template repository.
40+
# 2. The step is currently 0.
41+
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
42+
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
4543
if: >-
4644
${{ !github.event.repository.is_template
4745
&& needs.get_current_step.outputs.current_step == 0 }}
4846
49-
# We'll run Ubuntu for performance instead of Mac or Windows
47+
# We'll run Ubuntu for performance instead of Mac or Windows.
5048
runs-on: ubuntu-latest
5149

5250
steps:
53-
# We'll need to check out the repository so that we can edit the README
51+
# We'll need to check out the repository so that we can edit the README.
5452
- name: Checkout
5553
uses: actions/checkout@v3
5654
with:
57-
fetch-depth: 0 # Let's get all the branches
55+
fetch-depth: 0 # Let's get all the branches.
5856

5957
- name: Prepare a branch
6058
run: |
6159
echo "Make sure we are on step 0"
62-
if [ "$(cat .github/script/STEP)" != 0 ]
60+
if [ "$(cat .github/steps/-step.txt)" != 0 ]
6361
then
6462
echo "Current step is not 0"
6563
exit 0
@@ -83,10 +81,9 @@ jobs:
8381
env:
8482
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8583

86-
# Update README to close <details id=0> and open <details id=1>
87-
# and set STEP to '1'
84+
# In README.md, switch step 0 for step 1.
8885
- name: Update to step 1
89-
uses: skills/action-update-step@v1
86+
uses: skills/action-update-step@v2
9087
with:
9188
token: ${{ secrets.GITHUB_TOKEN }}
9289
from_step: 0

.github/workflows/1-create-a-pr.yml

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
name: Step 1, Create a pull request
1+
name: Step 1, Create a pull request
22

33
# This step triggers after the learner creates a pull request for the my-resume branch
4-
# This step sets STEP to 2
5-
# This step closes <details id=1> and opens <details id=2>
4+
# This workflow updates from step 1 to step 2.
65

7-
# This will run every time we open a pull request
8-
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
6+
# This will run every time we open a pull request.
7+
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
98
on:
109
workflow_dispatch:
1110
pull_request:
1211
types: [opened]
1312

14-
# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
13+
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
1514
permissions:
16-
# Need `contents: read` to checkout the repository
17-
# Need `contents: write` to update the step metadata
15+
# Need `contents: read` to checkout the repository.
16+
# Need `contents: write` to update the step metadata.
1817
contents: write
1918

2019
jobs:
21-
# Get the current step from .github/script/STEP so we can
22-
# limit running the main job when the learner is on the same step.
20+
# Get the current step to only run the main job when the learner is on the same step.
2321
get_current_step:
2422
name: Check current step number
2523
runs-on: ubuntu-latest
@@ -28,49 +26,49 @@ jobs:
2826
uses: actions/checkout@v3
2927
- id: get_step
3028
run: |
31-
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
29+
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
3230
outputs:
3331
current_step: ${{ steps.get_step.outputs.current_step }}
3432

3533
on_create_pr:
36-
name: On create PR
34+
name: On create PR
3735
needs: get_current_step
3836

3937
# We will only run this action when:
40-
# 1. This repository isn't the template repository
41-
# 2. The STEP is currently 1
42-
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
43-
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
38+
# 1. This repository isn't the template repository.
39+
# 2. The step is currently 1.
40+
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
41+
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
4442
if: >-
4543
${{ !github.event.repository.is_template
4644
&& needs.get_current_step.outputs.current_step == 1 }}
4745
48-
# We'll run Ubuntu for performance instead of Mac or Windows
46+
# We'll run Ubuntu for performance instead of Mac or Windows.
4947
runs-on: ubuntu-latest
5048

5149
steps:
52-
# We'll need to check out the repository so that we can edit the README
50+
# We'll need to check out the repository so that we can edit the README.
5351
- name: Checkout
5452
uses: actions/checkout@v3
5553
with:
56-
fetch-depth: 0 # Let's get all the branches
54+
fetch-depth: 0 # Let's get all the branches.
5755

5856
- name: Prepare a merge conflict
5957
run: |
6058
echo "Make sure we are on step 1"
61-
if [ "$(cat .github/script/STEP)" != 1 ]
59+
if [ "$(cat .github/steps/-step.txt)" != 1 ]
6260
then
6361
echo "Current step is not 1"
6462
exit 0
6563
fi
6664
67-
echo "Manually update STEP in my-resume to match STEP in main branch"
65+
echo "Manually update step in my-resume to match step in main branch"
6866
git checkout my-resume
6967
git config user.name github-actions
7068
git config user.email [email protected]
71-
sed -i.bak 's/1/2/' .github/script/STEP
72-
git add .github/script/STEP
73-
git commit --message="Update STEP in my-resume"
69+
sed -i.bak 's/1/2/' .github/steps/-step.txt
70+
git add .github/steps/-step.txt
71+
git commit --message="Update step in my-resume"
7472
echo "Push"
7573
git push origin my-resume
7674
@@ -85,10 +83,9 @@ jobs:
8583
env:
8684
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8785

88-
# Update README to close <details id=1> and open <details id=2>
89-
# and set STEP to '2'
86+
# In README.md, switch step 1 for step 2.
9087
- name: Update to step 2
91-
uses: skills/action-update-step@v1
88+
uses: skills/action-update-step@v2
9289
with:
9390
token: ${{ secrets.GITHUB_TOKEN }}
9491
from_step: 1

0 commit comments

Comments
 (0)