Skip to content

Commit 84fdf7e

Browse files
feat: update grading workflows and refresh tool versions (skills#44)
1 parent 62bf9a3 commit 84fdf7e

File tree

7 files changed

+153
-211
lines changed

7 files changed

+153
-211
lines changed

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

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
if: |
1919
!github.event.repository.is_template
2020
name: Start Exercise
21-
uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.3.0
21+
uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.4.0
2222
with:
2323
exercise-title: "Getting Started with GitHub Copilot"
2424
intro-message: "Welcome to the exciting world of GitHub Copilot! 🚀 In this exercise, you'll unlock the potential of this AI-powered coding assistant to accelerate your development process. Let's dive in and have some fun exploring the future of coding together! 💻✨"
@@ -38,22 +38,18 @@ jobs:
3838
- name: Get response templates
3939
uses: actions/checkout@v4
4040
with:
41-
repository: skills/response-templates
42-
path: skills-response-templates
43-
44-
- name: Configure Git user
45-
run: |
46-
git config user.name github-actions[bot]
47-
git config user.email github-actions[bot]@users.noreply.github.com
41+
repository: skills/exercise-toolkit
42+
path: exercise-toolkit
43+
ref: v0.4.0
4844

4945
- name: Build comment - add step content
5046
id: build-comment
51-
uses: skills/action-text-variables@v1
47+
uses: skills/action-text-variables@v2
5248
with:
5349
template-file: ${{ env.STEP_1_FILE }}
5450
template-vars: |
55-
login=${{ github.actor }}
56-
full_repo_name=${{ github.repository }}
51+
login: ${{ github.actor }}
52+
full_repo_name: ${{ github.repository }}
5753
5854
- name: Create comment - add step content
5955
run: |
@@ -66,13 +62,12 @@ jobs:
6662
- name: Create comment - watching for progress
6763
run: |
6864
gh issue comment "$ISSUE_URL" \
69-
--body-file "skills-response-templates/step-feedback/watching-for-progress.md"
65+
--body-file "exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md"
7066
env:
7167
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7268

7369
- name: Disable current workflow and enable next one
7470
run: |
75-
# gh workflow enable "Step 0" # Already disabled
7671
gh workflow enable "Step 1"
7772
env:
7873
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/1-preparing.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
jobs:
1717
find_exercise:
1818
name: Find Exercise Issue
19-
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.1.0
19+
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.4.0
2020

2121
check_step_work:
2222
name: Check step work
@@ -32,13 +32,14 @@ jobs:
3232
- name: Get response templates
3333
uses: actions/checkout@v4
3434
with:
35-
repository: skills/response-templates
36-
path: skills-response-templates
35+
repository: skills/exercise-toolkit
36+
path: exercise-toolkit
37+
ref: v0.4.0
3738

3839
- name: Update comment - checking work
3940
run: |
4041
gh issue comment "$ISSUE_URL" \
41-
--body-file skills-response-templates/step-feedback/checking-work.md \
42+
--body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
4243
--edit-last
4344
env:
4445
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -52,11 +53,11 @@ jobs:
5253

5354
- name: Build message - step finished
5455
id: build-message-step-finish
55-
uses: skills/action-text-variables@v1
56+
uses: skills/action-text-variables@v2
5657
with:
57-
template-file: skills-response-templates/step-feedback/step-finished-prepare-next-step.md
58+
template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
5859
template-vars: |
59-
next_step_number=2
60+
next_step_number: 2
6061
6162
- name: Update comment - step finished
6263
run: |
@@ -81,8 +82,9 @@ jobs:
8182
- name: Get response templates
8283
uses: actions/checkout@v4
8384
with:
84-
repository: skills/response-templates
85-
path: skills-response-templates
85+
repository: skills/exercise-toolkit
86+
path: exercise-toolkit
87+
ref: v0.4.0
8688

8789
- name: Create comment - add step content
8890
run: |
@@ -94,7 +96,7 @@ jobs:
9496
- name: Create comment - watching for progress
9597
run: |
9698
gh issue comment "$ISSUE_URL" \
97-
--body-file skills-response-templates/step-feedback/watching-for-progress.md
99+
--body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
98100
env:
99101
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100102

.github/workflows/2-first-introduction.yml

Lines changed: 42 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
jobs:
1919
find_exercise:
2020
name: Find Exercise Issue
21-
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.1.0
21+
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.4.0
2222

2323
check_step_work:
2424
name: Check step work
@@ -34,74 +34,67 @@ jobs:
3434
- name: Get response templates
3535
uses: actions/checkout@v4
3636
with:
37-
repository: skills/response-templates
38-
path: skills-response-templates
37+
repository: skills/exercise-toolkit
38+
path: exercise-toolkit
39+
ref: v0.4.0
3940

4041
- name: Update comment - checking work
4142
run: |
4243
gh issue comment "$ISSUE_URL" \
43-
--body-file skills-response-templates/step-feedback/checking-work.md \
44+
--body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
4445
--edit-last
4546
env:
4647
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4748

4849
# START: Check practical exercise
4950

50-
# Search for the comment about registration validation
51-
- name: Check contents of 'src/app.py'
52-
run: |
53-
# File and expected phrase
54-
file="src/app.py"
55-
keyphrase="Validate student is not already signed up"
56-
57-
# Fail the workflow if the file content is missing
58-
if ! grep -q "$keyphrase" "$file"; then
59-
message="It seems our registration validation bug has not been fixed. Please try again."
60-
gh issue comment "$ISSUE_URL" \
61-
--body "$message" \
62-
--edit-last
63-
exit 1
64-
fi
65-
env:
66-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-
68-
# Check the number of activities in the file by counting the json keys
6951
- name: Check for additional student activities
52+
id: check-additional-activities
53+
continue-on-error: true
54+
uses: skills/action-keyphrase-checker@v1
55+
with:
56+
text-file: src/app.py
57+
keyphrase: '"description"'
58+
minimum-occurrences: 4
59+
case-sensitive: false
60+
61+
- name: Build message - step results
62+
id: build-message-step-results
63+
uses: skills/action-text-variables@v2
64+
with:
65+
template-file: exercise-toolkit/markdown-templates/step-feedback/step-results-table.md
66+
template-vars: |
67+
step_number: 2
68+
passed: ${{ !contains(steps.*.outcome, 'failure') }}
69+
results_table:
70+
- description: "New activities added to src/app.py. We found ${{ steps.check-additional-activities.outputs.occurrences }} activities (minimum 4 required)"
71+
passed: ${{ steps.check-additional-activities.outcome == 'success' }}
72+
73+
- name: Create comment - step results
7074
run: |
71-
# File and phrase to count
72-
file="src/app.py"
73-
keyphrase='"description":'
74-
minimum_occurences=4
75-
76-
# Get the number of occurences of the keyphrase
77-
found_occurences=$(grep -o "$keyphrase" "$file" | wc -l)
78-
79-
# If the number of occurences is less than the minimum, fail the workflow and send a message
80-
if [ "$found_occurences" -lt "$minimum_occurences" ]; then
81-
message="No new student activities were found. Please use Copilot to generate some and try again."
82-
gh issue comment "$ISSUE_URL" \
83-
--body "$message" \
84-
--edit-last
85-
exit 1
86-
fi
75+
gh issue comment "$ISSUE_URL" \
76+
--body "$COMMENT_BODY" \
77+
--edit-last
8778
env:
8879
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
COMMENT_BODY: ${{ steps.build-message-step-results.outputs.updated-text }}
8981

90-
# END: Check practical exercise
82+
- name: Fail job if not all checks passed
83+
if: contains(steps.*.outcome, 'failure')
84+
run: exit 1
9185

9286
- name: Build message - step finished
9387
id: build-message-step-finish
94-
uses: skills/action-text-variables@v1
88+
uses: skills/action-text-variables@v2
9589
with:
96-
template-file: skills-response-templates/step-feedback/step-finished-prepare-next-step.md
90+
template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
9791
template-vars: |
98-
next_step_number=3
92+
next_step_number: 3
9993
10094
- name: Update comment - step finished
10195
run: |
10296
gh issue comment "$ISSUE_URL" \
103-
--body "$ISSUE_BODY" \
104-
--edit-last
97+
--body "$ISSUE_BODY"
10598
env:
10699
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107100
ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }}
@@ -120,8 +113,9 @@ jobs:
120113
- name: Get response templates
121114
uses: actions/checkout@v4
122115
with:
123-
repository: skills/response-templates
124-
path: skills-response-templates
116+
repository: skills/exercise-toolkit
117+
path: exercise-toolkit
118+
ref: v0.4.0
125119

126120
- name: Create comment - add step content
127121
run: |
@@ -133,7 +127,7 @@ jobs:
133127
- name: Create comment - watching for progress
134128
run: |
135129
gh issue comment "$ISSUE_URL" \
136-
--body-file skills-response-templates/step-feedback/watching-for-progress.md
130+
--body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
137131
env:
138132
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139133

0 commit comments

Comments
 (0)