Scan secrets once per change instead of twice - #208
Merged
Conversation
The `push` trigger carried no branch filter, so every push to a topic branch started a scan and the pull_request event started a second one over the same commits — plainly visible as two "Secret scan" runs on each Dependabot PR. The existing concurrency group does not merge them. The push run keys on `github.ref`, the PR run on `github.event.pull_request.number`, so the two land in different groups and neither cancels the other. Scoping `push` to main keeps both cases that matter: branch commits are scanned through `pull_request`, and main keeps a run of its own — the one that scans all reachable history after a merge.
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.
secret-scan.ymlhad apushtrigger with no branch filter. Every push to atopic branch started a scan, and the
pull_requestevent started a second oneover the same commits moments later — two "Secret scan" runs per change, plainly
visible on every Dependabot PR.
The existing
concurrencygroup does not collapse them: the push run keys ongithub.ref, the PR run ongithub.event.pull_request.number, so the two landin different groups and neither cancels the other.
Scoping
pushtomainkeeps both cases that matter — branch commits staycovered by
pull_request, andmainkeeps a run of its own, which is the onethat scans all reachable history after a merge.
merge_group,workflow_dispatchand the weekly schedule are untouched.
Note this PR itself still shows the old double run; the change only takes effect
for pushes after it lands.
🤖 Generated with Claude Code