Skip to content

Commit 661cf7c

Browse files
authored
fix: ensure semantic-release runs on exact workflow commit (#93)
- Add explicit ref checkout and force reset to workflow SHA - This prevents GITHUB_TOKEN 401 errors when semantic-release tries to create releases for non-HEAD commits - GITHUB_TOKEN can only create releases/tags for the current HEAD commit due to GitHub API limitations - Based on GitHub community findings: https://github.com/orgs/community/discussions/121022
1 parent cf2243c commit 661cf7c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

.github/workflows/semantic-release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ jobs:
4343
with:
4444
fetch-depth: 0
4545
token: ${{ secrets.GITHUB_TOKEN }}
46+
ref: ${{ github.ref_name }}
47+
48+
- name: Force branch to workflow SHA
49+
run: |
50+
git reset --hard ${{ github.sha }}
4651
4752
- name: Setup Python and UV
4853
uses: ./.github/actions/setup-python-uv

0 commit comments

Comments
 (0)