File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,15 @@ jobs:
2626 fetch-depth : 0
2727 ref : ${{ env.RELEASE_REF }}
2828
29- - name : Ensure tag is published from main
29+ - name : Ensure tag points to default branch
3030 run : |
31- git fetch origin main
32- if ! git merge-base --is-ancestor "$(git rev-parse HEAD)" origin/main; then
33- echo "::error::Release tag must point to a commit reachable from main"
31+ git fetch origin
32+ TARGET_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
33+ if [ -z "$TARGET_BRANCH" ]; then
34+ TARGET_BRANCH=master
35+ fi
36+ if ! git merge-base --is-ancestor "$(git rev-parse HEAD)" "origin/${TARGET_BRANCH}"; then
37+ echo "::error::Release tag must point to a commit reachable from ${TARGET_BRANCH}"
3438 exit 1
3539 fi
3640
You can’t perform that action at this time.
0 commit comments