Skip to content

Commit 8f78d7b

Browse files
committed
fix: use RELEASE_TOKEN for auto-bump in release workflow
Uses RELEASE_TOKEN (a PAT with Contents write permission) to bypass branch protection when auto-bumping the version. Setup required: 1. Create a Fine-Grained PAT at GitHub Settings → Developer Settings → Personal Access Tokens 2. Grant it 'Contents: Read and write' permission for this repo 3. Add it as a repository secret named RELEASE_TOKEN The workflow falls back to GITHUB_TOKEN if RELEASE_TOKEN is not set, which will fail on protected branches but work on unprotected ones.
1 parent 51496b7 commit 8f78d7b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,15 @@ jobs:
129129
echo "should_release=false" >> $GITHUB_OUTPUT
130130
131131
# Bump version in Cargo.toml if needed
132+
# Uses RELEASE_TOKEN (PAT) to bypass branch protection, falls back to GITHUB_TOKEN
132133
bump-version:
133134
needs: check
134135
if: needs.check.outputs.should_release == 'true' && needs.check.outputs.needs_bump == 'true'
135136
runs-on: ubuntu-latest
136137
steps:
137138
- uses: actions/checkout@v4
138139
with:
139-
token: ${{ secrets.GITHUB_TOKEN }}
140+
token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
140141

141142
- name: Update Cargo.toml version
142143
run: |
@@ -154,7 +155,7 @@ jobs:
154155
git commit -m "chore: bump version to $VERSION [skip ci]"
155156
git push
156157
env:
157-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
158+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
158159

159160
build:
160161
needs: [check, bump-version]

0 commit comments

Comments
 (0)