Skip to content

Commit 35e16e1

Browse files
feat: use grantbirki/comment for commenting and update grading job in step 3 (#1940)
Co-authored-by: Christopher W. Blake <chriswblake@github.com>
1 parent 901f967 commit 35e16e1

File tree

6 files changed

+178
-302
lines changed

6 files changed

+178
-302
lines changed

.github/steps/x-review.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ If you'd like to make a profile README, use the quickstart instructions below or
2424
Check out these resources to learn more or get involved:
2525

2626
- 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).
27+
- [Take another GitHub Skills exercise](https://learn.github.com/skills).
2828
- [Read the GitHub Getting Started docs](https://docs.github.com/en/get-started).
2929
- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore).

.github/workflows/0-start-exercise.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ permissions:
1010
actions: write # Disable/enable workflows
1111
issues: write # Create issue and comment on issues
1212

13-
1413
env:
1514
STEP_1_FILE: ".github/steps/1-create-a-branch.md"
1615

@@ -19,18 +18,18 @@ jobs:
1918
if: |
2019
!github.event.repository.is_template
2120
name: Start Exercise
22-
uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.6.0
21+
uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.7.0
2322
with:
2423
exercise-title: "Introduction to GitHub"
2524
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."
2625

27-
2826
post_next_step_content:
2927
name: Post next step content
3028
runs-on: ubuntu-latest
3129
needs: [start_exercise]
3230
env:
33-
ISSUE_URL: ${{ needs.start_exercise.outputs.issue-url }}
31+
ISSUE_REPOSITORY: ${{ github.repository }}
32+
ISSUE_NUMBER: ${{ needs.start_exercise.outputs.issue-number }}
3433

3534
steps:
3635
- name: Checkout
@@ -41,21 +40,21 @@ jobs:
4140
with:
4241
repository: skills/exercise-toolkit
4342
path: exercise-toolkit
44-
ref: v0.6.0
43+
ref: v0.7.0
4544

4645
- 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 }}
46+
uses: GrantBirki/comment@v2.1.1
47+
with:
48+
repository: ${{ env.ISSUE_REPOSITORY }}
49+
issue-number: ${{ env.ISSUE_NUMBER }}
50+
file: ${{ env.STEP_1_FILE }}
5251

5352
- 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 }}
53+
uses: GrantBirki/comment@v2.1.1
54+
with:
55+
repository: ${{ env.ISSUE_REPOSITORY }}
56+
issue-number: ${{ env.ISSUE_NUMBER }}
57+
file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
5958

6059
- name: Disable current workflow and enable next one
6160
run: |

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

Lines changed: 25 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -21,56 +21,15 @@ env:
2121
jobs:
2222
find_exercise:
2323
name: Find Exercise Issue
24-
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.6.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.6.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 }}
24+
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0
6725

6826
post_next_step_content:
6927
name: Post next step content
70-
needs: [find_exercise, check_step_work]
28+
needs: [find_exercise]
7129
runs-on: ubuntu-latest
7230
env:
73-
ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
31+
ISSUE_REPOSITORY: ${{ github.repository }}
32+
ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }}
7433

7534
steps:
7635
- name: Checkout
@@ -81,25 +40,34 @@ jobs:
8140
with:
8241
repository: skills/exercise-toolkit
8342
path: exercise-toolkit
84-
ref: v0.6.0
43+
ref: v0.7.0
44+
45+
- name: Create comment - step finished
46+
uses: GrantBirki/comment@v2.1.1
47+
with:
48+
repository: ${{ env.ISSUE_REPOSITORY }}
49+
issue-number: ${{ env.ISSUE_NUMBER }}
50+
file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
51+
vars: |
52+
next_step_number: 2
8553
8654
- 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 }}
55+
uses: GrantBirki/comment@v2.1.1
56+
with:
57+
repository: ${{ env.ISSUE_REPOSITORY }}
58+
issue-number: ${{ env.ISSUE_NUMBER }}
59+
file: ${{ env.STEP_2_FILE }}
9260

9361
- 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 }}
62+
uses: GrantBirki/comment@v2.1.1
63+
with:
64+
repository: ${{ env.ISSUE_REPOSITORY }}
65+
issue-number: ${{ env.ISSUE_NUMBER }}
66+
file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
9967

10068
- name: Disable current workflow and enable next one
10169
run: |
102-
gh workflow disable "Step 1"
70+
gh workflow disable "${{github.workflow}}"
10371
gh workflow enable "Step 2"
10472
env:
10573
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/2-commit-a-file.yml

Lines changed: 27 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ name: Step 2 # Commit a file
22

33
# Checks if the learner completed tasks for step 2.
44
# - 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.
65

76
on:
87
push:
98
branches:
109
- "my-first-branch"
10+
paths:
11+
- "PROFILE.md"
1112

1213
permissions:
1314
contents: read
@@ -17,70 +18,18 @@ permissions:
1718
env:
1819
STEP_3_FILE: ".github/steps/3-open-a-pull-request.md"
1920

20-
2121
jobs:
2222
find_exercise:
2323
name: Find Exercise Issue
24-
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.6.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.6.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 }}
24+
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0
7725

7826
post_next_step_content:
7927
name: Post next step content
80-
needs: [find_exercise, check_step_work]
28+
needs: [find_exercise]
8129
runs-on: ubuntu-latest
8230
env:
83-
ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
31+
ISSUE_REPOSITORY: ${{ github.repository }}
32+
ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }}
8433

8534
steps:
8635
- name: Checkout
@@ -91,25 +40,34 @@ jobs:
9140
with:
9241
repository: skills/exercise-toolkit
9342
path: exercise-toolkit
94-
ref: v0.6.0
43+
ref: v0.7.0
44+
45+
- name: Create comment - step finished
46+
uses: GrantBirki/comment@v2.1.1
47+
with:
48+
issue-number: ${{ env.ISSUE_NUMBER }}
49+
repository: ${{ env.ISSUE_REPOSITORY }}
50+
file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
51+
vars: |
52+
next_step_number: 3
9553
9654
- 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 }}
55+
uses: GrantBirki/comment@v2.1.1
56+
with:
57+
repository: ${{ env.ISSUE_REPOSITORY }}
58+
issue-number: ${{ env.ISSUE_NUMBER }}
59+
file: ${{ env.STEP_3_FILE }}
10260

10361
- 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 }}
62+
uses: GrantBirki/comment@v2.1.1
63+
with:
64+
repository: ${{ env.ISSUE_REPOSITORY }}
65+
issue-number: ${{ env.ISSUE_NUMBER }}
66+
file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
10967

11068
- name: Disable current workflow and enable next one
11169
run: |
112-
gh workflow disable "Step 2"
70+
gh workflow disable "${{github.workflow}}"
11371
gh workflow enable "Step 3"
11472
env:
11573
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)