Skip to content

Commit d9a1359

Browse files
fix: explicitly configure git remote to use PAT_TOKEN for pushes (#235)
* fix: use PAT_TOKEN to bypass branch protection in release workflow Allows the cargo-workspaces release workflow to push version bump commits to the main branch by using a Personal Access Token with bypass permissions when available, falling back to GITHUB_TOKEN otherwise. * fix: explicitly configure git remote to use PAT_TOKEN for pushes cargo-workspaces uses git internally for pushes and needs the remote URL to be configured with the PAT token to bypass branch protection rules. This ensures the PAT_TOKEN is used for git push operations, not just checkout.
1 parent e9c0edf commit d9a1359

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/workflows/cargo-workspaces-release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ jobs:
5757
git config user.name "github-actions[bot]"
5858
git config user.email "github-actions[bot]@users.noreply.github.com"
5959
60+
# Configure git remote to use PAT_TOKEN for pushes
61+
if [ -n "${{ secrets.PAT_TOKEN }}" ]; then
62+
echo "Configuring git to use PAT_TOKEN for pushes"
63+
git remote set-url origin https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}.git
64+
else
65+
echo "PAT_TOKEN not available, using GITHUB_TOKEN"
66+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
67+
fi
68+
6069
- name: Verify authentication (non-dry-run)
6170
if: ${{ !inputs.dry_run }}
6271
env:

0 commit comments

Comments
 (0)