Commit 05f513c
ci: skip unnecessary jobs based on change detection (#892)
## Description
Adds a `detect-changes` job to the main CI workflow that classifies
changed files and conditionally skips expensive jobs when they aren't
needed. This reduces CI time and resource usage for documentation,
config, and CI-only PRs.
## Changes
- Added a `detect-changes` job that categorizes files into: docs,
config/tooling, CI, and code
- **Docs-only PRs** (`.md`, `.txt`, `docs/`, `.claude/`, `LICENSE`): run
lint only, skip build, test, integration, e2e, and security scan
- This could be further optimized in the future by not running eslint
unnecessarily
- **Config-only PRs** (`.eslintrc`, `.prettierrc`, `.editorconfig`,
etc.): run lint only, skip build/test/e2e
- **CI-only PRs** (`.github/workflows/`, `.github/actions/`): run
actionlint only, skip everything else
- **Code PRs**: run everything as before (no change)
- Added a `lint-only` job for config-only changes that don't need the
full build/test pipeline
- Updated `all-jobs-complete` gate to dynamically verify success based
on what was expected to run
- Pushes to `main` always run the full pipeline regardless of file types
- Added a step summary with change detection results for easy debugging
## Testing
This is a CI workflow change. It can be validated by observing the
GitHub Actions run on this PR itself — since the only changed file is
`.github/workflows/main.yml`, the `detect-changes` job should classify
it as CI-only and skip lint/build/test jobs. The workflow is also
self-testing through its own merge queue integration.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Medium risk because it changes CI gating logic and could
unintentionally skip required checks or misclassify changes, affecting
merge protection and security scanning coverage.
>
> **Overview**
> Adds a new `detect-changes` job that diffs against the PR/merge-queue
base SHA and classifies changes into `has-code`, `has-ci`, and
`has-lint-targets`, publishing a step summary for debugging.
>
> Updates the main workflow to **conditionally run** `check-workflows`,
`analyse-code`, and `lint-build-test` only when relevant (while always
running the full pipeline on pushes to `main`), and introduces a
`lint-only` job for non-code changes.
>
> Refactors `all-jobs-complete` to dynamically enforce success based on
the detected change category (including requiring `detect-changes` to
succeed) so the final gate accurately reflects what was expected to run.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6ac945e. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 2b97357 commit 05f513c
1 file changed
Lines changed: 166 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
29 | 116 | | |
30 | 117 | | |
31 | 118 | | |
32 | | - | |
33 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
34 | 123 | | |
35 | 124 | | |
36 | 125 | | |
| |||
43 | 132 | | |
44 | 133 | | |
45 | 134 | | |
46 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
47 | 141 | | |
48 | 142 | | |
49 | 143 | | |
| |||
55 | 149 | | |
56 | 150 | | |
57 | 151 | | |
58 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
59 | 158 | | |
60 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
61 | 183 | | |
62 | 184 | | |
63 | 185 | | |
| |||
107 | 229 | | |
108 | 230 | | |
109 | 231 | | |
| 232 | + | |
110 | 233 | | |
| 234 | + | |
| 235 | + | |
111 | 236 | | |
112 | 237 | | |
| 238 | + | |
113 | 239 | | |
114 | 240 | | |
115 | 241 | | |
116 | 242 | | |
117 | 243 | | |
118 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
119 | 280 | | |
120 | 281 | | |
121 | 282 | | |
| |||
0 commit comments