File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -268,6 +268,10 @@ jobs:
268268 run : |
269269 TAG="${{ steps.get_version.outputs.tag }}"
270270 echo "Tag to create: $TAG"
271+
272+ # Explicitly update remote with token to ensure correct authentication
273+ git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
274+
271275 if git ls-remote --tags origin "$TAG" | grep -q "$TAG"; then
272276 echo "Tag $TAG already exists on remote, skipping tag creation."
273277 else
Original file line number Diff line number Diff line change 1+ name : Test Tag Creation
2+ on :
3+ workflow_dispatch :
4+
5+ jobs :
6+ test-tagging :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - name : Checkout repository
10+ uses : actions/checkout@v4
11+ with :
12+ token : ${{ secrets.PAT_TOKEN }}
13+
14+ - name : Test Tag Creation and Push
15+ env :
16+ GITHUB_TOKEN : ${{ secrets.PAT_TOKEN }}
17+ run : |
18+ # Create a temporary test tag
19+ TAG="test-tag-v$(date +%s)"
20+ echo "Attempting to create and push tag: $TAG"
21+
22+ git config user.name "github-actions[bot]"
23+ git config user.email "github-actions[bot]@users.noreply.github.com"
24+
25+ # Explicitly update remote with token to ensure correct authentication
26+ git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
27+
28+ git tag "$TAG"
29+
30+ echo "Pushing tag..."
31+ git push origin "$TAG"
32+
33+ echo "Tag pushed successfully. Cleaning up..."
34+ git push --delete origin "$TAG"
35+ echo "Cleanup complete."
36+
You can’t perform that action at this time.
0 commit comments