Skip to content

fix(ci): pin Trivy SARIF upload to PR head ref - #2891

Merged
DerekRoberts merged 2 commits into
mainfrom
fix/trivy-sarif-pr-head-2890
Oct 13, 2026
Merged

DerekRoberts merged 2 commits into
mainfrom
fix/trivy-sarif-pr-head-2890

Conversation

@DerekRoberts

Copy link
Copy Markdown
Member

Pin the pull request Trivy SARIF upload to the PR head ref and commit SHA to prevent code scanning ruleset stalls on job retries and branch updates.

Under on: pull_request triggers, upload-sarif@v4 defaults to uploading against the temporary test-merge ref (refs/pull/<pr>/merge) and ephemeral merge commit. If downstream repositories require Trivy in their branch protection rulesets (Require code scanning results), any retry, rerun, or merge ref recalculation shifts the merge commit SHA and leaves the PR stuck waiting for Trivy.

This separates the upload step by event type:

  • Pull requests explicitly specify ref: refs/pull/<pr>/head and sha: github.event.pull_request.head.sha, binding the scan to the immutable PR head commit.
  • Push, schedule, and workflow_dispatch triggers on main retain the default ambient ref and SHA.

Closes #2890

@DerekRoberts
DerekRoberts marked this pull request as ready for review October 13, 2026 16:18
Copilot AI balanced review requested due to automatic review settings October 13, 2026 16:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@DerekRoberts DerekRoberts self-assigned this Oct 13, 2026
@DerekRoberts DerekRoberts moved this from New to Active in DevOps (NR) Oct 13, 2026
@DerekRoberts
DerekRoberts merged commit 2496063 into main Oct 13, 2026
20 checks passed
@DerekRoberts
DerekRoberts deleted the fix/trivy-sarif-pr-head-2890 branch October 13, 2026 19:20
@github-project-automation github-project-automation Bot moved this from Active to Done in DevOps (NR) Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(ci): pin Trivy checkout and SARIF upload to PR head ref to prevent ruleset stalls

2 participants