Skip to content

fix(ci): generate-sbom – always checkout latest main, handle same-day reruns - #71

Merged
sei-vsarvepalli merged 3 commits into
mainfrom
copilot/fix-github-actions-job-generate-sbom
Aug 2, 2026
Merged

fix(ci): generate-sbom – always checkout latest main, handle same-day reruns#71
sei-vsarvepalli merged 3 commits into
mainfrom
copilot/fix-github-actions-job-generate-sbom

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

The generate-sbom workflow failed on same-day reruns because git push was rejected when the sbom/update-YYYY-MM-DD branch already existed on the remote. Additionally, the checkout used the triggering commit SHA rather than the HEAD of main, so concurrent or queued runs could generate SBOMs from a stale tree.

Changes

  • Always pull latest main — add ref: main to actions/checkout@v4 so SBOM generation always reflects the current state of the default branch, not the specific triggering commit.
  • Handle existing same-day branch — replace git push origin with git push --force origin so reruns on the same calendar day update the existing branch rather than erroring out.
  • Skip duplicate PR creation — guard gh pr create with a pre-check; if a PR for the branch already exists the step is a no-op (the force-pushed commits are automatically reflected in the open PR).
- uses: actions/checkout@v4
  with:
    ref: main          # always latest, not the triggering commit SHA

# ...

git push --force origin "$BRANCH"

gh pr view "$BRANCH" > /dev/null 2>&1 || gh pr create \
  --title "chore: update SBOM inventory (${DATE})" \
  --body "..."

Copilot AI changed the title [WIP] Fix failing GitHub Actions job generate-sbom fix(ci): generate-sbom – always checkout latest main, handle same-day reruns Aug 2, 2026
Copilot AI requested a review from sei-vsarvepalli August 2, 2026 21:45

@sei-vsarvepalli sei-vsarvepalli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This change is helpful lets do it.

@sei-vsarvepalli
sei-vsarvepalli requested a review from Copilot August 2, 2026 21:46
@sei-vsarvepalli
sei-vsarvepalli marked this pull request as ready for review August 2, 2026 21:47

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.

Pull request overview

This PR hardens the generate-sbom GitHub Actions workflow to make reruns idempotent and ensure SBOMs are generated from the latest main branch state rather than the triggering commit.

Changes:

  • Check out main explicitly during the workflow run to avoid generating SBOMs from a stale commit when runs are queued/concurrent.
  • Force-push the daily sbom/update-YYYY-MM-DD branch so same-day reruns update the existing branch instead of failing.
  • Avoid failing on duplicate PR creation by only creating a PR when one doesn’t already exist for the branch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/generate-sbom.yml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sei-vsarvepalli
sei-vsarvepalli merged commit 51cee7a into main Aug 2, 2026
2 checks passed
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.

3 participants