Fix release branch resolution picking stale feature branches#359
Merged
Conversation
git branch -r --contains matches any branch that has the tag commit as an ancestor, not just the branch it was cut from. Long-lived or merged branches keep that ancestry indefinitely, so alphabetical head -n 1 could select the wrong branch (e.g. a stale feature branch instead of main), which then made the checkout in the Commit changes step collide with the uncommitted pom.xml version bump. Switch to git for-each-ref --points-at to match only the branch whose tip is exactly the tag commit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
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.
Summary
shared-build-and-deploy.ymlusedgit branch -r --contains $TAG_COMMIT, which matches any remote branch that has the tag commit as an ancestor — not just the branch the tag was cut from.git branch -rsorts alphabetically, sohead -n 1could pick the wrong branch (e.g. a staleSK-2967-...branch instead ofmain) on a recent public release.git checkout $BRANCH_NAMEin the "Commit changes" step to fail, since itspom.xmldiffered from the uncommitted version bump on the tag commit.git for-each-ref --points-at="$TAG_COMMIT"to match only the branch whose tip is exactly the tag commit, filtering out theorigin/HEADsymref entry.