Skip to content

Commit 322f20f

Browse files
committed
ci: use PAT to create a tag
1 parent 2520d97 commit 322f20f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,21 @@ jobs:
192192
echo "$ASSETS" >> $GITHUB_ENV
193193
echo "EOF" >> $GITHUB_ENV
194194
195-
- name: Create and push tag
195+
- name: Create tag via API
196+
env:
197+
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
196198
run: |
197-
git config user.name "GitHub Action"
198-
git config user.email "action@github.com"
199-
git tag -a "v${{ env.VERSION }}" -m "Release v${{ env.VERSION }}"
200-
git push origin "v${{ env.VERSION }}"
199+
# Get the current commit SHA
200+
COMMIT_SHA=$(git rev-parse HEAD)
201+
202+
# Create tag via GitHub API (bypasses push restrictions)
203+
gh api \
204+
--method POST \
205+
-H "Accept: application/vnd.github+json" \
206+
-H "X-GitHub-Api-Version: 2022-11-28" \
207+
/repos/${{ github.repository }}/git/refs \
208+
-f "ref=refs/tags/v${{ env.VERSION }}" \
209+
-f "sha=${COMMIT_SHA}" || echo "Tag may already exist"
201210
202211
- name: Create GitHub Release and Upload Assets
203212
uses: softprops/action-gh-release@v2

0 commit comments

Comments
 (0)