Skip to content

Commit

Permalink
Update course format for accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
heiskr committed May 30, 2023
1 parent e78a2e2 commit fd7fad6
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 81 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions .github/steps/0-welcome.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- readme -->
28 changes: 13 additions & 15 deletions .github/workflows/0-start.yml → .github/workflows/0-welcome.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
name: Step 0, Start
name: Step 0, Welcome

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

# This will run every time we create push a commit to `main`
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
workflow_dispatch:
push:
branches:
- main

# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
permissions:
# Need `contents: read` to checkout the repository
# Need `contents: write` to update the step metadata
contents: write

jobs:
# Get the current step from .github/script/STEP so we can
# Get the current step from .github/steps/-step.txt so we can
# limit running the main job when the learner is on the same step.
get_current_step:
name: Check current step number
Expand All @@ -29,7 +28,7 @@ jobs:
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

Expand All @@ -39,9 +38,9 @@ jobs:

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 0
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
# 2. The step is currently 0
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 0 }}
Expand All @@ -59,7 +58,7 @@ jobs:
- name: Prepare a branch
run: |
echo "Make sure we are on step 0"
if [ "$(cat .github/script/STEP)" != 0 ]
if [ "$(cat .github/steps/-step.txt)" != 0 ]
then
echo "Current step is not 0"
exit 0
Expand All @@ -83,10 +82,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Update README to close <details id=0> and open <details id=1>
# and set STEP to '1'
- name: Update to step 1
uses: skills/action-update-step@v1
# In README.md, switch step 0 for step 1.
- name: Update to step 1
uses: skills/action-update-step@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 0
Expand Down
34 changes: 16 additions & 18 deletions .github/workflows/1-create-a-pr.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
name: Step 1, Create a pull request

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

# This will run every time we open a pull request
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
workflow_dispatch:
pull_request:
types: [opened]

# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
permissions:
# Need `contents: read` to checkout the repository
# Need `contents: write` to update the step metadata
contents: write

jobs:
# Get the current step from .github/script/STEP so we can
# Get the current step from .github/steps/-step.txt so we can
# limit running the main job when the learner is on the same step.
get_current_step:
name: Check current step number
Expand All @@ -28,7 +27,7 @@ jobs:
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

Expand All @@ -38,9 +37,9 @@ jobs:

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 1
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
# 2. The step is currently 1
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 1 }}
Expand All @@ -58,19 +57,19 @@ jobs:
- name: Prepare a merge conflict
run: |
echo "Make sure we are on step 1"
if [ "$(cat .github/script/STEP)" != 1 ]
if [ "$(cat .github/steps/-step.txt)" != 1 ]
then
echo "Current step is not 1"
exit 0
fi
echo "Manually update STEP in my-resume to match STEP in main branch"
echo "Manually update step in my-resume to match step in main branch"
git checkout my-resume
git config user.name github-actions
git config user.email github-actions@github.com
sed -i.bak 's/1/2/' .github/script/STEP
git add .github/script/STEP
git commit --message="Update STEP in my-resume"
sed -i.bak 's/1/2/' .github/steps/-step.txt
git add .github/steps/-step.txt
git commit --message="Update step in my-resume"
echo "Push"
git push origin my-resume
Expand All @@ -85,10 +84,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Update README to close <details id=1> and open <details id=2>
# and set STEP to '2'
- name: Update to step 2
uses: skills/action-update-step@v1
# In README.md, switch step 1 for step 2.
- name: Update to step 2
uses: skills/action-update-step@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 1
Expand Down
26 changes: 12 additions & 14 deletions .github/workflows/2-resolve-a-merge-conflict.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
name: Step 2, Resolve a merge conflict

# This step triggers after the user resolves the merge conflict
# This step sets STEP to 3
# This step closes <details id=2> and opens <details id=3>
# This workflow updates from step 2 to step 3.

# This will run every time we push to `my-resume` (this will be a merge commit
# since the user is resolving a merge conflict)
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
workflow_dispatch:
push:
branches:
- my-resume

# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
permissions:
# Need `contents: read` to checkout the repository
# Need `contents: write` to update the step metadata
contents: write

jobs:
# Get the current step from .github/script/STEP so we can
# Get the current step from .github/steps/-step.txt so we can
# limit running the main job when the learner is on the same step.
get_current_step:
name: Check current step number
Expand All @@ -30,7 +29,7 @@ jobs:
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

Expand All @@ -40,9 +39,9 @@ jobs:

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 2
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
# 2. The step is currently 2
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 2 }}
Expand All @@ -61,7 +60,7 @@ jobs:
- name: Create and push a new file on main
run: |
echo "Make sure we are on step 2"
if [ "$(cat .github/script/STEP)" != 2 ]
if [ "$(cat .github/steps/-step.txt)" != 2 ]
then
echo "Current step is not 2"
exit 0
Expand All @@ -84,10 +83,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Update README to close <details id=2> and open <details id=3>
# and set STEP to '3'
- name: Update to step 3
uses: skills/action-update-step@v1
# In README.md, switch step 2 for step 3.
- name: Update to step 3
uses: skills/action-update-step@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 2
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/3-create-your-own-conflict.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Step 3, Create your own conflict

# This step triggers after the user creates `references.md` in the `my-resume` branch
# This step sets STEP to 4
# This step closes <details id=3> and opens <details id=4>
# This workflow updates from step 3 to step 4.

# This will run every time we push to the `reference.md` file in the `my-resume` branch
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
workflow_dispatch:
push:
Expand All @@ -14,14 +13,14 @@ on:
paths:
- 'references.md'

# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
permissions:
# Need `contents: read` to checkout the repository
# Need `contents: write` to update the step metadata
contents: write

jobs:
# Get the current step from .github/script/STEP so we can
# Get the current step from .github/steps/-step.txt so we can
# limit running the main job when the learner is on the same step.
get_current_step:
name: Check current step number
Expand All @@ -31,7 +30,7 @@ jobs:
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

Expand All @@ -41,9 +40,9 @@ jobs:

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 3
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
# 2. The step is currently 3
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 3 }}
Expand All @@ -59,10 +58,9 @@ jobs:
fetch-depth: 0 # Let's get all the branches
ref: my-resume

# Update README to close <details id=2> and open <details id=3>
# and set STEP to '4'
- name: Update to step 4
uses: skills/action-update-step@v1
# In README.md, switch step 2 for step 3.
- name: Update to step 4
uses: skills/action-update-step@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 3
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/4-merge-your-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
name: Step 4, Merge your pull request

# This step triggers after a pull requst is merged to `main`
# This step sets STEP to X
# This step closes <details id=3> and opens <details id=X>
# This workflow updates from step to step X.

# This will run every time we create push a commit to `main`
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
workflow_dispatch:
push:
branches:
- main

# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
permissions:
# Need `contents: read` to checkout the repository
# Need `contents: write` to update the step metadata
contents: write

jobs:
# Get the current step from .github/script/STEP so we can
# Get the current step from .github/steps/-step.txt so we can
# limit running the main job when the learner is on the same step.
get_current_step:
name: Check current step number
Expand All @@ -29,7 +28,7 @@ jobs:
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

Expand All @@ -39,9 +38,9 @@ jobs:

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 4
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
# 2. The step is currently 4
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 4 }}
Expand All @@ -56,10 +55,9 @@ jobs:
with:
fetch-depth: 0 # Let's get all the branches

# Update README to close <details id=3> and open <details id=X>
# and set STEP to 'X'
- name: Update to step X
uses: skills/action-update-step@v1
# In README.md, switch step 3 for step X.
- name: Update to step X
uses: skills/action-update-step@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 4
Expand Down
Loading

0 comments on commit fd7fad6

Please sign in to comment.