Repository navigation
ci: advanced CodeQL setup with PR concurrency (disable default setup first) - #595
bastionstack wants to merge 2 commits into
Conversation
Default code-scanning setup cannot be coalesced, so a burst of pushes to a PR (e.g. the Figma token plugin's one-commit-per-file pushes) spawns N parallel scans. Advanced setup keyed by github.ref cancels only superseded runs of the same PR, mirroring ci.yml. Requires disabling default CodeQL setup before merge, else both run.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
There was a problem hiding this comment.
Pull request overview
Introduces an advanced CodeQL workflow (.github/workflows/codeql.yml) to replace GitHub’s default CodeQL setup, enabling PR-scoped concurrency so repeated pushes to the same PR coalesce into a single active scan run.
Changes:
- Adds a new CodeQL workflow that runs on
pull_request,pushtomain, and a weeklyschedule. - Adds
concurrencykeyed bygithub.refand cancels superseded PR runs only. - Configures a language matrix for
actions,go(autobuild), andjavascript-typescript.
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| schedule: | ||
| - cron: "27 3 * * 1" |
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@v3 | ||
| with: | ||
| languages: ${{ matrix.language }} | ||
| build-mode: ${{ matrix.build-mode }} |
|
Closing in favour of GitHub's built-in generator. Rather than hand-maintain this file, the right move is Switch to advanced in Settings (it disables default setup atomically and generates the canonical |
Summary
Replaces GitHub's default CodeQL code-scanning setup with an advanced
setup (
.github/workflows/codeql.yml) so we can add a concurrency group.Why: default setup starts a fresh scan on every push to an open PR and
cannot be coalesced (there's no workflow file to attach
concurrencyto).The Figma design-token plugin pushes one commit per token file, so a single
sync is a burst of 5 pushes to the sync PR — and default setup spawns
2 scans × 5 pushes = 10 parallel CodeQL runs that all run to completion.
We saw exactly this on #592.
Advanced setup, keyed by
github.ref, cancels only superseded runs of thesame PR — mirroring what
ci.ymlalready does forfull-pr:github.refis unique per PR (refs/pull/N/merge) and per branch, so thisnever cancels another person's PR.
cancel-in-progressis scoped topull_request, so pushes tomainand scheduled scans always run tocompletion. Job names (
Analyze (actions|go|javascript-typescript)) areunchanged, so branch-protection required checks keep matching.
GitHub does not allow default and advanced CodeQL setups to coexist. You must
turn off default setup first, or the advanced runs fail with
"default setup is enabled".
CodeQL (this only disables default setup; advanced takes over on merge).
Analyze (...)checks are still the oneslisted under Settings → Branches → branch protection → required status
checks (names match, but worth a glance).
Expected on this PR: while default setup is still enabled, the
Analyze (...)checks on this PR will be red. That is the intended signal that step 2
hasn't happened yet — they go green once default setup is disabled.
Validation
actionlint .github/workflows/codeql.yml— clean.ci.ymlhas run in production.actions,goautobuild,javascript-typescript) mirrorsthe languages default setup currently analyzes.
Release notes / changeset
None — CI-only change, no published package behavior affected (per the
changeset decision table).
Notes
Pairs with the design-token sync coalescing change (
cancel-in-progress: trueon
sync-design-tokens.yml, riding tomainvia #592). Together they stop aone-commit-per-file plugin push from fanning out into a scan/CI storm.