Skip to content

ci: analyse and score only the newest main commit - #2548

Open
DeusData wants to merge 1 commit into
mainfrom
ci/main-push-concurrency
Open

DeusData wants to merge 1 commit into
mainfrom
ci/main-push-concurrency

Conversation

@DeusData

@DeusData DeusData commented Oct 4, 2026

Copy link
Copy Markdown
Owner

What

CodeQL SAST and OpenSSF Scorecard analyse only the newest main commit. A newer push to main cancels the run of an older one.

Why

CodeQL SAST keyed its concurrency group by commit SHA on push events, so each merge to main got its own group and nothing was ever cancelled. Scorecard had no group. On 2026-10-04, a day of 36 merges queued one CodeQL analysis (40-100 minutes each) and one Scorecard run per merge, ahead of every pull request run:

  • Pull request CI waited hours for a runner.
  • One main analysis waited 4 hours.
  • 48 superseded runs had to be cancelled by hand.

Changes

  • .github/workflows/codeql.yml: the group is now codeql-<event>-<PR number or ref>.
    • Pull requests keep one analysis each, as before, so the PR codeql-gate is unaffected.
    • Pushes to main share one group, so a newer push cancels an older analysis.
  • .github/workflows/scorecard.yml: new group scorecard-<ref> with cancel-in-progress.
  • DCO is unchanged on purpose. Its push run on main is the check that catches a merge rewriting sign-offs, so a superseded push still needs it, and a DCO job takes seconds.

Code scanning tracks the default branch's latest analysis, so skipping intermediate main commits loses no alert.

Verification

Both files parse (Ruby YAML) and contain only ASCII. Each concurrency block is 2 keys.

CodeQL SAST keyed its concurrency group by commit SHA on push events,
so every merge to main got its own group and nothing was ever
cancelled; OpenSSF Scorecard had no group at all. On 2026-10-04 a day
of 36 merges queued one CodeQL analysis (40-100 minutes each) and one
Scorecard run per merge, ahead of every pull request run: pull request
CI waited hours for a runner, and a main analysis waited 4 hours.

CodeQL now groups by event and by pull request number or ref, so pull
requests keep one analysis each as before, and a newer push to main
cancels the analysis of an older main commit. Scorecard groups by ref
with the same cancellation. Only the newest main commit matters for
both: code scanning tracks the default branch's latest analysis.

DCO keeps its per-commit group on purpose: its push run on main is the
check that catches a merge rewriting sign-offs, so a superseded push
must still be checked, and a DCO job takes seconds.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant