Skip to content

Commit 910adb3

Browse files
sorccuclaude
andauthored
ci: skip lint, tests and e2e for meta-file-only changes (#1401)
Adds a `changes` job that uses dorny/paths-filter with predicate-quantifier 'every' and a negated ignore list, so `code` is true only when a changed file lives outside .claude/, the root markdown files, LICENSE and .gitignore. The heavy jobs are gated on that output; a PR touching only meta files skips the whole matrix. The filter runs inside a job rather than as an `on: paths-ignore` trigger: a workflow skipped by a trigger-level path filter never reports a status, so required checks stay pending forever and block merge. check-ai-context.yml documents the same constraint. The gate jobs keep running via `if: always()` and already treat 'skipped' as passing, so branch protection still gets a status. They now also depend on `changes`, so a failure to compute the filter fails the gate rather than green-lighting a matrix that never ran. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 69cf8a3 commit 910adb3

1 file changed

Lines changed: 60 additions & 6 deletions

File tree

.github/workflows/test.yml

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,48 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21+
# ---------------------------------------------------------------------------
22+
# Detects whether anything outside the ignore list below changed. Meta files
23+
# (agent instructions, docs, license, .gitignore) cannot affect lint,
24+
# packaging or test outcomes, so a change touching only those skips the whole
25+
# matrix.
26+
#
27+
# The filter runs inside a job rather than as an `on: paths-ignore` trigger:
28+
# a workflow skipped by a trigger-level path filter never reports a status, so
29+
# required checks stay pending forever and block merge. The CI gates below
30+
# depend on this job, so if it fails, the gates fail rather than passing on a
31+
# matrix that never ran.
32+
# ---------------------------------------------------------------------------
33+
changes:
34+
name: detect changes
35+
runs-on: ubuntu-latest
36+
permissions:
37+
pull-requests: read
38+
outputs:
39+
code: ${{ steps.filter.outputs.code }}
40+
steps:
41+
- uses: actions/checkout@v3
42+
- uses: dorny/paths-filter@v3
43+
id: filter
44+
with:
45+
# 'every' makes a file match `code` only when it matches *all* the
46+
# patterns, i.e. when it is none of the ignored paths. `code` is
47+
# therefore true when at least one changed file lives outside the
48+
# ignore list.
49+
predicate-quantifier: 'every'
50+
filters: |
51+
code:
52+
- '!.claude/**'
53+
- '!AGENTS.md'
54+
- '!CLAUDE.md'
55+
- '!CONTRIBUTING.md'
56+
- '!LICENSE'
57+
- '!README.md'
58+
- '!.gitignore'
59+
2160
lint:
61+
needs: changes
62+
if: needs.changes.outputs.code == 'true'
2263
runs-on: ubuntu-latest
2364
steps:
2465
- uses: actions/checkout@v3
@@ -39,6 +80,8 @@ jobs:
3980
# ---------------------------------------------------------------------------
4081
test-ubuntu:
4182
name: test - ubuntu
83+
needs: changes
84+
if: needs.changes.outputs.code == 'true'
4285
runs-on: ubuntu-latest
4386
steps:
4487
- uses: actions/checkout@v3
@@ -61,6 +104,8 @@ jobs:
61104
retention-days: 1
62105
test-windows:
63106
name: test - windows
107+
needs: changes
108+
if: needs.changes.outputs.code == 'true'
64109
runs-on: blacksmith-4vcpu-windows-2025
65110
steps:
66111
- uses: actions/checkout@v3
@@ -88,7 +133,8 @@ jobs:
88133
# ---------------------------------------------------------------------------
89134
test-e2e-checkly-ubuntu:
90135
name: e2e - checkly - ubuntu
91-
if: github.event_name == 'pull_request'
136+
needs: changes
137+
if: github.event_name == 'pull_request' && needs.changes.outputs.code == 'true'
92138
runs-on: ubuntu-latest
93139
steps:
94140
- uses: actions/checkout@v3
@@ -110,7 +156,8 @@ jobs:
110156
CHECKLY_EMPTY_API_KEY: ${{ secrets.E2E_EMPTY_CHECKLY_API_KEY }}
111157
test-e2e-checkly-windows:
112158
name: e2e - checkly - windows (${{ matrix.shard }})
113-
if: github.event_name == 'pull_request'
159+
needs: changes
160+
if: github.event_name == 'pull_request' && needs.changes.outputs.code == 'true'
114161
strategy:
115162
fail-fast: false
116163
matrix:
@@ -140,7 +187,8 @@ jobs:
140187
# ---------------------------------------------------------------------------
141188
test-e2e-create-checkly-ubuntu:
142189
name: e2e - create-checkly - ubuntu
143-
if: github.event_name == 'pull_request'
190+
needs: changes
191+
if: github.event_name == 'pull_request' && needs.changes.outputs.code == 'true'
144192
runs-on: ubuntu-latest
145193
steps:
146194
- uses: actions/checkout@v3
@@ -155,7 +203,8 @@ jobs:
155203
- run: pnpm --filter create-checkly run test:e2e
156204
test-e2e-create-checkly-windows:
157205
name: e2e - create-checkly - windows
158-
if: github.event_name == 'pull_request'
206+
needs: changes
207+
if: github.event_name == 'pull_request' && needs.changes.outputs.code == 'true'
159208
runs-on: blacksmith-4vcpu-windows-2025
160209
steps:
161210
- uses: actions/checkout@v3
@@ -179,6 +228,7 @@ jobs:
179228
name: CI gate - ubuntu
180229
if: always()
181230
needs:
231+
- changes
182232
- lint
183233
- test-ubuntu
184234
- test-e2e-checkly-ubuntu
@@ -189,8 +239,11 @@ jobs:
189239
run: |
190240
results="${{ join(needs.*.result, ', ') }}"
191241
echo "Ubuntu job results: $results"
192-
# 'skipped' is allowed (e2e jobs are skipped on push-to-main); only
193-
# 'failure'/'cancelled' should fail the gate.
242+
# 'skipped' is allowed (e2e jobs are skipped on push-to-main, and
243+
# every job is skipped for meta-file-only changes); only
244+
# 'failure'/'cancelled' should fail the gate. `changes` is a
245+
# dependency so that a failure to compute the path filter fails the
246+
# gate instead of green-lighting a matrix that never ran.
194247
if [[ "$results" == *failure* || "$results" == *cancelled* ]]; then
195248
echo "::error::One or more Ubuntu jobs did not succeed"
196249
exit 1
@@ -199,6 +252,7 @@ jobs:
199252
name: CI gate - windows
200253
if: always()
201254
needs:
255+
- changes
202256
- test-windows
203257
- test-e2e-checkly-windows
204258
- test-e2e-create-checkly-windows

0 commit comments

Comments
 (0)