Skip to content
43 changes: 29 additions & 14 deletions .github/workflows/3-copilot-edits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,38 @@ jobs:
file: exercise-toolkit/markdown-templates/step-feedback/checking-work.md
edit-mode: replace

- name: Check for participant info in app.js
# START: Check practical exercise

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v47
with:
base_sha: ${{ github.event.repository.default_branch }}
files: |
src/static/app.js
src/static/styles.css

- name: Check if app.js was modified
id: check-app-js
continue-on-error: true
uses: skills/action-keyphrase-checker@v1
uses: actions/github-script@v7
with:
text-file: src/static/app.js
keyphrase: participant
minimum-occurrences: 3
case-sensitive: false
script: |
const changedFiles = '${{ steps.changed-files.outputs.all_changed_files }}'.split(' ');
if (!changedFiles.includes('src/static/app.js')) {
core.setFailed('src/static/app.js was not modified');
}

- name: Check for participant info in styles.css
- name: Check if styles.css was modified
id: check-styles-css
continue-on-error: true
uses: skills/action-keyphrase-checker@v1
uses: actions/github-script@v7
with:
text-file: src/static/styles.css
keyphrase: participant
minimum-occurrences: 1
case-sensitive: false
script: |
const changedFiles = '${{ steps.changed-files.outputs.all_changed_files }}'.split(' ');
if (!changedFiles.includes('src/static/styles.css')) {
core.setFailed('src/static/styles.css was not modified');
}

- name: Update comment - step results
uses: GrantBirki/[email protected]
Expand All @@ -87,11 +100,13 @@ jobs:
vars: |
step_number: 3
results_table:
- description: "Check app.js for participant info"
- description: "Checked if app.js for participant info"
passed: ${{ steps.check-app-js.outcome == 'success' }}
- description: "Check styles.css for participant info"
- description: "Checked if styles.css for participant info"
passed: ${{ steps.check-styles-css.outcome == 'success' }}

# END: Check practical exercise

- name: Fail job if not all checks passed
if: contains(steps.*.outcome, 'failure')
run: exit 1
Expand Down
Loading