From b4969ecd0e4200471e4210ff8fa8b3875c0e18c3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 12:48:10 +0000 Subject: [PATCH 1/9] Replace keyphrase checker with file change detection for step 3 Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com> --- .github/workflows/3-copilot-edits.yml | 51 ++++++++++++++++++--------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index 16866279..c185c10f 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -56,25 +56,42 @@ jobs: file: exercise-toolkit/markdown-templates/step-feedback/checking-work.md edit-mode: replace - - name: Check for participant info in app.js - id: check-app-js - continue-on-error: true - uses: skills/action-keyphrase-checker@v1 + - name: Fetch main branch + run: git fetch origin main:main + + - name: Get changed files compared to main + id: changed-files + uses: tj-actions/changed-files@v45 with: - text-file: src/static/app.js - keyphrase: participant - minimum-occurrences: 3 - case-sensitive: false + base_sha: main + sha: ${{ github.sha }} + files: | + src/static/app.js + src/static/styles.css - - name: Check for participant info in styles.css + - name: Check if app.js was modified + id: check-app-js + continue-on-error: true + run: | + if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q "src/static/app.js"; then + echo "✅ app.js was modified compared to main branch" + exit 0 + else + echo "❌ app.js was not modified compared to main branch" + exit 1 + fi + + - name: Check if styles.css was modified id: check-styles-css continue-on-error: true - uses: skills/action-keyphrase-checker@v1 - with: - text-file: src/static/styles.css - keyphrase: participant - minimum-occurrences: 1 - case-sensitive: false + run: | + if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q "src/static/styles.css"; then + echo "✅ styles.css was modified compared to main branch" + exit 0 + else + echo "❌ styles.css was not modified compared to main branch" + exit 1 + fi - name: Update comment - step results uses: GrantBirki/comment@v2.1.1 @@ -87,9 +104,9 @@ jobs: vars: | step_number: 3 results_table: - - description: "Check app.js for participant info" + - description: "Check app.js was modified" passed: ${{ steps.check-app-js.outcome == 'success' }} - - description: "Check styles.css for participant info" + - description: "Check styles.css was modified" passed: ${{ steps.check-styles-css.outcome == 'success' }} - name: Fail job if not all checks passed From acdc44e7028497137fd23737eef8952b6c8c1653 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 12:49:50 +0000 Subject: [PATCH 2/9] Use any_changed output for more reliable file change detection Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com> --- .github/workflows/3-copilot-edits.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index c185c10f..e3780363 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -60,20 +60,26 @@ jobs: run: git fetch origin main:main - name: Get changed files compared to main - id: changed-files + id: changed-files-app-js uses: tj-actions/changed-files@v45 with: base_sha: main sha: ${{ github.sha }} - files: | - src/static/app.js - src/static/styles.css + files: src/static/app.js + + - name: Get changed files compared to main + id: changed-files-styles-css + uses: tj-actions/changed-files@v45 + with: + base_sha: main + sha: ${{ github.sha }} + files: src/static/styles.css - name: Check if app.js was modified id: check-app-js continue-on-error: true run: | - if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q "src/static/app.js"; then + if [[ "${{ steps.changed-files-app-js.outputs.any_changed }}" == "true" ]]; then echo "✅ app.js was modified compared to main branch" exit 0 else @@ -85,7 +91,7 @@ jobs: id: check-styles-css continue-on-error: true run: | - if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q "src/static/styles.css"; then + if [[ "${{ steps.changed-files-styles-css.outputs.any_changed }}" == "true" ]]; then echo "✅ styles.css was modified compared to main branch" exit 0 else From de1de82f23c1d3aa0c97eb977c4331718afcd8d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 14:56:21 +0000 Subject: [PATCH 3/9] Simplify workflow using default_branch and direct output reference Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com> --- .github/workflows/3-copilot-edits.yml | 47 +++++---------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index e3780363..367f524a 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -56,49 +56,20 @@ jobs: file: exercise-toolkit/markdown-templates/step-feedback/checking-work.md edit-mode: replace - - name: Fetch main branch - run: git fetch origin main:main - - - name: Get changed files compared to main - id: changed-files-app-js + - name: Check if app.js was modified + id: check-app-js uses: tj-actions/changed-files@v45 with: - base_sha: main - sha: ${{ github.sha }} + base_sha: ${{ github.event.repository.default_branch }} files: src/static/app.js - - name: Get changed files compared to main - id: changed-files-styles-css + - name: Check if styles.css was modified + id: check-styles-css uses: tj-actions/changed-files@v45 with: - base_sha: main - sha: ${{ github.sha }} + base_sha: ${{ github.event.repository.default_branch }} files: src/static/styles.css - - name: Check if app.js was modified - id: check-app-js - continue-on-error: true - run: | - if [[ "${{ steps.changed-files-app-js.outputs.any_changed }}" == "true" ]]; then - echo "✅ app.js was modified compared to main branch" - exit 0 - else - echo "❌ app.js was not modified compared to main branch" - exit 1 - fi - - - name: Check if styles.css was modified - id: check-styles-css - continue-on-error: true - run: | - if [[ "${{ steps.changed-files-styles-css.outputs.any_changed }}" == "true" ]]; then - echo "✅ styles.css was modified compared to main branch" - exit 0 - else - echo "❌ styles.css was not modified compared to main branch" - exit 1 - fi - - name: Update comment - step results uses: GrantBirki/comment@v2.1.1 with: @@ -111,12 +82,12 @@ jobs: step_number: 3 results_table: - description: "Check app.js was modified" - passed: ${{ steps.check-app-js.outcome == 'success' }} + passed: ${{ steps.check-app-js.outputs.any_changed }} - description: "Check styles.css was modified" - passed: ${{ steps.check-styles-css.outcome == 'success' }} + passed: ${{ steps.check-styles-css.outputs.any_changed }} - name: Fail job if not all checks passed - if: contains(steps.*.outcome, 'failure') + if: steps.check-app-js.outputs.any_changed != 'true' || steps.check-styles-css.outputs.any_changed != 'true' run: exit 1 post_next_step_content: From cfd85dbbe65dea3eb1860ecf18230f8cbc7077f7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 14:57:43 +0000 Subject: [PATCH 4/9] Fix: use base parameter instead of base_sha for branch name Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com> --- .github/workflows/3-copilot-edits.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index 367f524a..698b6fa4 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -60,14 +60,14 @@ jobs: id: check-app-js uses: tj-actions/changed-files@v45 with: - base_sha: ${{ github.event.repository.default_branch }} + base: ${{ github.event.repository.default_branch }} files: src/static/app.js - name: Check if styles.css was modified id: check-styles-css uses: tj-actions/changed-files@v45 with: - base_sha: ${{ github.event.repository.default_branch }} + base: ${{ github.event.repository.default_branch }} files: src/static/styles.css - name: Update comment - step results From a18ca719f71282fa4107a4fbb425e195b9c060b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 15:02:04 +0000 Subject: [PATCH 5/9] Fix: use base_sha parameter name as suggested Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com> --- .github/workflows/3-copilot-edits.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index 698b6fa4..367f524a 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -60,14 +60,14 @@ jobs: id: check-app-js uses: tj-actions/changed-files@v45 with: - base: ${{ github.event.repository.default_branch }} + base_sha: ${{ github.event.repository.default_branch }} files: src/static/app.js - name: Check if styles.css was modified id: check-styles-css uses: tj-actions/changed-files@v45 with: - base: ${{ github.event.repository.default_branch }} + base_sha: ${{ github.event.repository.default_branch }} files: src/static/styles.css - name: Update comment - step results From 1554ccf23f8dc1278a5d360c95ffbd8f96e82ac5 Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Wed, 17 Dec 2025 10:52:12 +0000 Subject: [PATCH 6/9] Remain previous description in results table --- .github/workflows/3-copilot-edits.yml | 43 ++++++++++++++++++++------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index 367f524a..36918236 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -56,19 +56,38 @@ jobs: file: exercise-toolkit/markdown-templates/step-feedback/checking-work.md edit-mode: replace + # START: Check practical exercise + + - name: Get changed files (once) + 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 - uses: tj-actions/changed-files@v45 + continue-on-error: true + uses: actions/github-script@v7 with: - base_sha: ${{ github.event.repository.default_branch }} - files: src/static/app.js + 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 if styles.css was modified id: check-styles-css - uses: tj-actions/changed-files@v45 + continue-on-error: true + uses: actions/github-script@v7 with: - base_sha: ${{ github.event.repository.default_branch }} - files: src/static/styles.css + 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/comment@v2.1.1 @@ -81,13 +100,15 @@ jobs: vars: | step_number: 3 results_table: - - description: "Check app.js was modified" - passed: ${{ steps.check-app-js.outputs.any_changed }} - - description: "Check styles.css was modified" - passed: ${{ steps.check-styles-css.outputs.any_changed }} + - description: "Checked if app.js for participant info" + passed: ${{ steps.check-app-js.outcome == 'success' }} + - 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: steps.check-app-js.outputs.any_changed != 'true' || steps.check-styles-css.outputs.any_changed != 'true' + if: contains(steps.*.outcome, 'failure') run: exit 1 post_next_step_content: From db7997a014c1df32ffbb466f5687c530e9a7ba27 Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Wed, 17 Dec 2025 10:55:40 +0000 Subject: [PATCH 7/9] Remove comment --- .github/workflows/3-copilot-edits.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index 36918236..3a944d82 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -58,7 +58,7 @@ jobs: # START: Check practical exercise - - name: Get changed files (once) + - name: Get changed files id: changed-files uses: tj-actions/changed-files@v47 with: From e686e9f9535c545513514857e068eab4c6696474 Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Thu, 18 Dec 2025 10:06:37 +0000 Subject: [PATCH 8/9] Use env variables for checks --- .github/workflows/3-copilot-edits.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index 3a944d82..944763f6 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -71,22 +71,30 @@ jobs: id: check-app-js continue-on-error: true uses: actions/github-script@v7 + env: + CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + TARGET_FILE: src/static/app.js with: 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'); + const changedFiles = process.env.CHANGED_FILES.split(' '); + const targetFile = process.env.TARGET_FILE; + if (!changedFiles.includes(targetFile)) { + core.setFailed(`${targetFile} was not modified`); } - name: Check if styles.css was modified id: check-styles-css continue-on-error: true uses: actions/github-script@v7 + env: + CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + TARGET_FILE: src/static/styles.css with: 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'); + const changedFiles = process.env.CHANGED_FILES.split(' '); + const targetFile = process.env.TARGET_FILE; + if (!changedFiles.includes(targetFile)) { + core.setFailed(`${targetFile} was not modified`); } - name: Update comment - step results From 1e0f5332710e75a36f87e1897c957986113bc1dd Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Thu, 18 Dec 2025 10:10:44 +0000 Subject: [PATCH 9/9] Remove if --- .github/workflows/3-copilot-edits.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index 944763f6..6466d317 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -108,9 +108,9 @@ jobs: vars: | step_number: 3 results_table: - - description: "Checked if app.js for participant info" + - description: "Checked app.js for participant info" passed: ${{ steps.check-app-js.outcome == 'success' }} - - description: "Checked if styles.css for participant info" + - description: "Checked styles.css for participant info" passed: ${{ steps.check-styles-css.outcome == 'success' }} # END: Check practical exercise