Skip to content

Commit 6361f79

Browse files
fix: improve PAT_TOKEN handling and debugging in release workflow (#236)
* debug: add detailed token debugging to release workflow * fix: improve PAT_TOKEN handling and debugging in release workflow - Add comprehensive debug output for token availability - Fix environment variable access in git configuration step - Use proper env vars instead of direct secret interpolation in shell - Add explicit git remote verification steps These changes should resolve the PAT_TOKEN not being recognized properly, enabling bypass of branch protection rules in future releases.
1 parent f137cd2 commit 6361f79

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

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

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,47 @@ jobs:
5252
echo "cargo-workspaces already installed"
5353
fi
5454
55+
- name: Debug token configuration
56+
run: |
57+
echo "=== Token Debug Information ==="
58+
if [ -n "${{ secrets.PAT_TOKEN }}" ]; then
59+
echo "✅ PAT_TOKEN is available"
60+
echo "PAT_TOKEN length: ${#PAT_TOKEN}"
61+
else
62+
echo "❌ PAT_TOKEN is NOT available"
63+
fi
64+
65+
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
66+
echo "✅ GITHUB_TOKEN is available"
67+
else
68+
echo "❌ GITHUB_TOKEN is NOT available"
69+
fi
70+
echo "Current git remote:"
71+
git remote -v
72+
echo "=== End Debug ==="
73+
env:
74+
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
75+
5576
- name: Configure git
77+
env:
78+
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5680
run: |
5781
git config user.name "github-actions[bot]"
5882
git config user.email "github-actions[bot]@users.noreply.github.com"
5983
6084
# Configure git remote to use PAT_TOKEN for pushes
61-
if [ -n "${{ secrets.PAT_TOKEN }}" ]; then
85+
if [ -n "$PAT_TOKEN" ]; then
6286
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
87+
git remote set-url origin https://x-access-token:$PAT_TOKEN@github.com/${{ github.repository }}.git
6488
else
6589
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
90+
git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/${{ github.repository }}.git
6791
fi
6892
93+
echo "Final git remote configuration:"
94+
git remote -v
95+
6996
- name: Verify authentication (non-dry-run)
7097
if: ${{ !inputs.dry_run }}
7198
env:

0 commit comments

Comments
 (0)