1818jobs :
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