Skip to content

Conversation

@cgwalters
Copy link
Contributor

Previously the action used the base branch tip (github.event.pull_request.base.sha) as the baseline for regression detection. This caused false failures when the base branch improved after a PR was created - the PR would appear to regress even though it didn't change anything security-related.

Now we compute the merge base between the base and head SHAs, which represents where the PR branched from the target branch. This ensures we're answering the right question: 'Did this PR introduce regressions?' rather than 'Is this PR as good as current main?'

The merge base is stable and won't change when the base branch advances, so PRs will only fail if they actually introduce regressions, not because they're missing improvements that landed on main after the PR was created.

Assisted-by: OpenCode (Claude Sonnet 4)

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a great improvement, correctly changing the baseline for Scorecard regression detection to use the merge base. This will make the check more reliable and prevent false failures. The logic is sound and the changes are well-documented. I have a couple of suggestions to improve robustness in an edge case and to fix the local testing instructions provided in the comments.

Previously the action used the base branch tip (github.event.pull_request.base.sha)
as the baseline for regression detection. This caused false failures when the base
branch improved after a PR was created - the PR would appear to regress even though
it didn't change anything security-related.

Now we compute the merge base between the base and head SHAs, which represents where
the PR branched from the target branch. This ensures we're answering the right
question: 'Did this PR introduce regressions?' rather than 'Is this PR as good as
current main?'

The merge base is stable and won't change when the base branch advances, so PRs will
only fail if they actually introduce regressions, not because they're missing
improvements that landed on main after the PR was created.

Use head -n 1 to handle edge cases where git merge-base returns multiple SHAs
(e.g., after criss-cross merges).

Assisted-by: OpenCode (claude-sonnet-4-20250514)
Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters cgwalters force-pushed the fix-scorecard-merge-base branch from 718d39b to 22ad0e6 Compare January 22, 2026 22:30
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