Skip to content

Commit bf1911a

Browse files
committed
ci: restore release branch guard
1 parent 2f0db13 commit bf1911a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@ jobs:
2020
env:
2121
RELEASE_REF: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', github.event.inputs.tag) || github.ref }}
2222
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}
23-
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
2423
steps:
2524
- uses: actions/checkout@v4
2625
with:
2726
fetch-depth: 0
2827
ref: ${{ env.RELEASE_REF }}
2928

30-
- name: Ensure tag points to default branch
29+
- name: Ensure tag is published from main
3130
run: |
32-
TARGET_BRANCH=${DEFAULT_BRANCH:-master}
33-
git fetch origin "${TARGET_BRANCH}"
34-
if ! git merge-base --is-ancestor "$(git rev-parse HEAD)" "origin/${TARGET_BRANCH}"; then
35-
echo "::error::Release tag must point to a commit reachable from ${TARGET_BRANCH}"
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"
3634
exit 1
3735
fi
3836

0 commit comments

Comments
 (0)