ci(codeql): add main to push.branches to unfreeze default-branch status#4704
Conversation
GitHub Code Scanning indexes SARIF uploads by the ref they are tagged with. The default-branch status panel only counts uploads tagged with refs/heads/main. Since PR #3887 (2025-09-04), CodeQL only runs on refs/pull/<n>/merge and refs/heads/mq-working-branch-**; the custom merge queue fast-forwards main without firing a push event, so no SARIF ever lands on refs/heads/main and the status panel has been frozen since 2025-09-03. Adding main to push.branches ensures a CodeQL run fires after each fast-forward merge, tagging the upload with refs/heads/main and unfreezing the configuration panel. The existing configuration ID is preserved — no risk of orphaning historical alerts.
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 7cf846a | Docs | Datadog PR Page | Give us feedback! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-05-04 11:22:20 Comparing candidate commit 7cf846a in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 93 metrics, 8 unstable metrics.
|
bc4344c
into
main
Problem
The CodeQL status page shows the last scan date as 2025-09-03, even though CodeQL runs successfully on every PR and every
mq-working-branch-**push.This is an association problem, not an execution problem. GitHub Code Scanning indexes each SARIF upload by the
refthe trigger event carried. The default-branch status panel only counts uploads tagged withrefs/heads/main. CodeQL is running, but every upload it produces is filed under a non-default ref.Root cause
PR #3887 (2025-09-04, "move
mainCI checks to merge queue runs") restructured the workflow triggers:push: branches: [main, master]push: branches: [mq-working-branch-**]pull_request: branches: [main]pull_request:(no branch filter)merge_group:workflow_call:(unused — no caller wires CodeQL)After this change, CodeQL only ever sees refs of the form
refs/pull/<n>/mergeorrefs/heads/mq-working-branch-XXX. The repository's merge mechanism fast-forwardsmainonto a green staging commit and deletes the staging branch — nopushevent forrefs/heads/mainfires, so CodeQL never runs against the default branch. The SARIF uploaded during the queue run stays tagged with the staging ref even after that exact SHA becomesHEADofmain.This is asymmetric with GitHub's native merge queue: native queue events arrive on
refs/heads/gh-readonly-queue/main/<sha>and Code Scanning rolls those uploads up to the default branch on completion. Custom queues built on fast-forward branches get no such roll-up.Why it matters
mainview.Verification
git diffshows exactly one inserted line:- mainactionlint .github/workflows/codeql-analysis.ymlpasses with no errorsrefs/heads/mainFZTWS5DIOVRC653POJVWM3DPO5ZS6Y3PMRSXC3BNMFXGC3DZONUXGLTZNVWA