Skip to content

Commit 5faaa9c

Browse files
fix: modify step 3 grading to check for changed files instead of specific keywords (#117)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 11520d6 commit 5faaa9c

File tree

1 file changed

+38
-15
lines changed

1 file changed

+38
-15
lines changed

.github/workflows/3-copilot-edits.yml

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,46 @@ jobs:
5656
file: exercise-toolkit/markdown-templates/step-feedback/checking-work.md
5757
edit-mode: replace
5858

59-
- name: Check for participant info in app.js
59+
# START: Check practical exercise
60+
61+
- name: Get changed files
62+
id: changed-files
63+
uses: tj-actions/changed-files@v47
64+
with:
65+
base_sha: ${{ github.event.repository.default_branch }}
66+
files: |
67+
src/static/app.js
68+
src/static/styles.css
69+
70+
- name: Check if app.js was modified
6071
id: check-app-js
6172
continue-on-error: true
62-
uses: skills/action-keyphrase-checker@v1
73+
uses: actions/github-script@v7
74+
env:
75+
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
76+
TARGET_FILE: src/static/app.js
6377
with:
64-
text-file: src/static/app.js
65-
keyphrase: participant
66-
minimum-occurrences: 3
67-
case-sensitive: false
68-
69-
- name: Check for participant info in styles.css
78+
script: |
79+
const changedFiles = process.env.CHANGED_FILES.split(' ');
80+
const targetFile = process.env.TARGET_FILE;
81+
if (!changedFiles.includes(targetFile)) {
82+
core.setFailed(`${targetFile} was not modified`);
83+
}
84+
85+
- name: Check if styles.css was modified
7086
id: check-styles-css
7187
continue-on-error: true
72-
uses: skills/action-keyphrase-checker@v1
88+
uses: actions/github-script@v7
89+
env:
90+
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
91+
TARGET_FILE: src/static/styles.css
7392
with:
74-
text-file: src/static/styles.css
75-
keyphrase: participant
76-
minimum-occurrences: 1
77-
case-sensitive: false
93+
script: |
94+
const changedFiles = process.env.CHANGED_FILES.split(' ');
95+
const targetFile = process.env.TARGET_FILE;
96+
if (!changedFiles.includes(targetFile)) {
97+
core.setFailed(`${targetFile} was not modified`);
98+
}
7899
79100
- name: Update comment - step results
80101
uses: GrantBirki/comment@v2.1.1
@@ -87,11 +108,13 @@ jobs:
87108
vars: |
88109
step_number: 3
89110
results_table:
90-
- description: "Check app.js for participant info"
111+
- description: "Checked app.js for participant info"
91112
passed: ${{ steps.check-app-js.outcome == 'success' }}
92-
- description: "Check styles.css for participant info"
113+
- description: "Checked styles.css for participant info"
93114
passed: ${{ steps.check-styles-css.outcome == 'success' }}
94115
116+
# END: Check practical exercise
117+
95118
- name: Fail job if not all checks passed
96119
if: contains(steps.*.outcome, 'failure')
97120
run: exit 1

0 commit comments

Comments
 (0)