Repository navigation
ci: reuse main's CodeQL analysis for a language whose code didn't change - #366
Merged
Merged
Conversation
A pull request, merge queue group or push that leaves a language's code, CodeQL's config and codeql.yml as they were uploads main's analysis of the commit it was diffed against for its own commit, so the code scanning rule still gets every category without a new 15-minute Rust run.
botandbang
enabled auto-merge
November 1, 2026 23:46
bnb
approved these changes
Nov 1, 2026
Coverage Report for apps/web
File CoverageNo changed files found.SizeCompared with main. KiB are 1,024 bytes.
|
Coverage Report for apps/localtoolbox
File CoverageNo changed files found.SizeCompared with main. KiB are 1,024 bytes.
|
Rust coverageFrom run 103. Both are held to the thresholds in .cargo/config.toml.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
#353 runs every CodeQL language on every pull request, merge queue group and push, because the code scanning rule holds a commit until it has a result in every category main has. Rust's analysis takes 15 to 19 minutes on Linux, even for a pull request that changes no Rust. This gives each category its result without that run when nothing CodeQL reads for that language changed.
codeql_rustandcodeql_javascriptfilters inci.yml's changes job. Each covers what CodeQL extracts for that language without a build, plus.github/codeql/**andcodeql.yml, which pins the action and so the queries. The scope step outputscodeql_unchanged(the languages neither filter matched, ignoringall) andcodeql_base(the commit a push or merge queue group was diffed against, from last-passed).codeql.ymltakesunchangedandbase. A language inunchangedlooks for main's CodeQL analysis of the base commit in its category: for a pull request, the merge commit's first parent. If one exists, the job uploads that SARIF for this commit withupload-sarif, in about a minute, and skips init and analyze. If not, it analyses as before. That happens when main's push run hasn't analysed the base yet, or a push has no passed run to diff against. The matrix still lists every language, which ci: analyse every CodeQL language on every pull request, group and push #353's policy checks.tools/policy/workflows.rego. Everycodeql_*filter has to cover.github/codeql/codeql-config.ymlandcodeql.yml, so a config or action change analyses again. It has tests..github/CONTRIBUTING.mdand.github/NEW_PROJECT.md.The reused results are accurate: with no change to that language's files, its code at this commit is the same as at the base commit main analysed.
How it was tested
tools/policy.sh: 87/87 Rego tests at full coverage, 52/52 conftest checks. The new rule's two tests fail when the rule is broken on purpose.zizmor --offlineare clean.CodeQLas its tool and/language:rust/as its category.ci.ymlreuses both, a change tocodeql.ymlreuses neither, a push or group with a passed base reuses what it didn't change, and a push without one reuses nothing.codeql.yml, so its own run analyses everything. The first pull request after it that leaves Rust alone exercises the reuse path. If its queue entry then waits on "Code scanning is still expecting 1 result", reverting this restores ci: analyse every CodeQL language on every pull request, group and push #353's behaviour.Checklist
docs/and--helpstill say what the code does