Skip to content

Commit 1c526d3

Browse files
rajbosCopilot
andcommitted
ci: skip mutation tests on PRs with no TS source changes
Add a check-code-changes job that diffs the PR against the base branch and sets an output flag when .ts files under vscode-extension/src/ or vscode-extension/test/, or stryker.config.mjs, are modified. The mutation-testing job now depends on check-code-changes and only runs when vscode_src_changed == 'true', skipping it for docs, JSON data files, workflows, and other non-code changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c9f4619 commit 1c526d3

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,37 @@ jobs:
106106
vscode-extension/out/
107107
retention-days: 7
108108

109-
mutation-testing:
109+
check-code-changes:
110110
runs-on: ubuntu-latest
111-
needs: build
112111
if: github.event_name == 'pull_request'
112+
outputs:
113+
vscode_src_changed: ${{ steps.detect.outputs.changed }}
114+
steps:
115+
- name: Harden the runner (Audit all outbound calls)
116+
uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
117+
with:
118+
egress-policy: audit
119+
120+
- name: Checkout code
121+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
122+
with:
123+
fetch-depth: 0
124+
125+
- name: Detect vscode-extension source changes
126+
id: detect
127+
run: |
128+
changed=$(git diff --name-only origin/${{ github.base_ref }}...HEAD \
129+
| grep -cE '^vscode-extension/src/.*\.ts$|^vscode-extension/test/.*\.ts$|^vscode-extension/stryker\.config\.mjs$' || true)
130+
if [ "$changed" -gt 0 ]; then
131+
echo "changed=true" >> "$GITHUB_OUTPUT"
132+
else
133+
echo "changed=false" >> "$GITHUB_OUTPUT"
134+
fi
135+
136+
mutation-testing:
137+
runs-on: ubuntu-latest
138+
needs: [build, check-code-changes]
139+
if: github.event_name == 'pull_request' && needs.check-code-changes.outputs.vscode_src_changed == 'true'
113140
# Informational — does not block the PR. A failing mutation score
114141
# is visible in the artifact but does not block merging during rollout.
115142
continue-on-error: true

0 commit comments

Comments
 (0)