Skip to content

Commit 188325a

Browse files
committed
chore(ci): sign action release commits via API
- Rename release.yml to release-action.yml (Release Action) - Commit CHANGELOG via GitHub API so it shows as Verified - Create tag ref via API instead of git push - Drop persisted credentials from checkout
1 parent 58bb285 commit 188325a

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Release Action
22

33
on:
44
workflow_dispatch:
@@ -31,8 +31,7 @@ jobs:
3131
with:
3232
ref: main
3333
fetch-depth: 0
34-
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
35-
persist-credentials: true
34+
persist-credentials: false
3635

3736
- name: Determine version and scheme
3837
id: version
@@ -67,11 +66,17 @@ jobs:
6766
fi
6867
fi
6968
70-
- name: Create and push tag
69+
# Local tag is needed for changelog generation; remote ref is created via the API
70+
- name: Create tag
7171
if: github.event_name == 'workflow_dispatch'
72+
env:
73+
GH_TOKEN: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
74+
TAG: ${{ steps.version.outputs.tag }}
7275
run: |
73-
git tag "${{ steps.version.outputs.tag }}"
74-
git push origin "${{ steps.version.outputs.tag }}"
76+
git tag "$TAG"
77+
gh api "repos/${GITHUB_REPOSITORY}/git/refs" \
78+
-f ref="refs/tags/${TAG}" \
79+
-f sha="$(git rev-parse HEAD)"
7580
7681
- name: Get previous tag
7782
id: previous
@@ -116,10 +121,14 @@ jobs:
116121
useGitmojis: false
117122
writeToFile: true
118123

124+
# Commits via the GitHub API are signed by GitHub and show as Verified
119125
- name: Commit updated CHANGELOG
120126
if: steps.previous.outputs.found == 'true'
121-
uses: stefanzweifel/git-auto-commit-action@v7
127+
uses: planetscale/ghcommit-action@v0.2.22
122128
with:
123-
branch: main
124129
commit_message: "docs: update CHANGELOG for ${{ steps.version.outputs.tag }}"
130+
repo: ${{ github.repository }}
131+
branch: main
125132
file_pattern: CHANGELOG.md
133+
env:
134+
GITHUB_TOKEN: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)