@@ -28,16 +28,26 @@ jobs:
28
28
29
29
- name : Create and push annotated tag (minor+1, patch=0)
30
30
env :
31
- GH_TOKEN : ${{ secrets.GIST_AUTH_TOKEN }}
31
+ PERSONAL_ACCESS_TOKEN : ${{ secrets.GIST_AUTH_TOKEN }}
32
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
32
33
run : |
33
34
set -euo pipefail
34
35
MAJOR="${{ steps.gitversion.outputs.major }}"
35
36
MINOR="${{ steps.gitversion.outputs.minor }}"
36
37
# increment minor and set patch to 0
37
38
NEW_MINOR=$((MINOR + 1))
38
39
TAG="v${MAJOR}.${NEW_MINOR}.0"
39
- git config user.name github-actions[bot]
40
- git config user.email 41898282+github-actions[bot]@users.noreply.github.com
41
- git tag -a $TAG -m "Tag created by GitHub Actions using GitVersion (incremented minor)"
42
- git push origin $TAG
40
+ echo "Computed tag: $TAG"
41
+ git config user.name "github-actions[bot]"
42
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
43
+ # create annotated tag (fail if exists)
44
+ git tag -a "$TAG" -m "Tag created by GitHub Actions using GitVersion (incremented minor)"
45
+ # choose token: use PAT if provided (recommended), otherwise fallback to GITHUB_TOKEN
46
+ TOKEN="${PERSONAL_ACCESS_TOKEN:-${GITHUB_TOKEN}}"
47
+ if [ -z "$TOKEN" ]; then
48
+ echo "No token available to push tag"
49
+ exit 1
50
+ fi
51
+ # Push the tag using the chosen token over HTTPS to ensure it triggers other workflows
52
+ git push "https://x-access-token:${TOKEN}@github.com/${{ github.repository }}" "$TAG"
43
53
0 commit comments