Skip to content

Commit caaca8f

Browse files
andykenwardclaude
andauthored
ci: pr automation use github app token (#769)
* ci: pr automation use github app token * ci: scope app token to contents and pull-requests Limit the minted GitHub App token to the permissions each automation job actually needs (contents:write to push the branch, pull-requests:write to open the PR) instead of inheriting the App's blanket installation permissions, per zizmor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9dc482e commit caaca8f

2 files changed

Lines changed: 32 additions & 4 deletions

File tree

.github/workflows/sync-readme-versions.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,17 @@ jobs:
3838
run: pnpm run sync:readme
3939
env:
4040
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 #v3.2.0
42+
id: app-token
43+
with:
44+
client-id: ${{ vars.APP_CLIENT_ID }}
45+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
46+
permission-contents: write
47+
permission-pull-requests: write
4148
- name: Commit and push version reference updates
4249
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 #v8.1.1
4350
with:
44-
token: ${{ secrets.GITHUB_TOKEN }}
51+
token: ${{ steps.app-token.outputs.token }}
4552
commit-message: 'docs: update action version references [skip ci]'
4653
sign-commits: true
4754
title: 'docs: update action version references'

.github/workflows/update.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,18 @@ jobs:
3232
run: pnpm run download
3333
env:
3434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 #v3.2.0
36+
id: app-token
37+
with:
38+
client-id: ${{ vars.APP_CLIENT_ID }}
39+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
40+
permission-contents: write
41+
permission-pull-requests: write
3542
- name: Create Pull Request
3643
id: cpr
3744
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 #v8.1.1
3845
with:
39-
token: ${{ secrets.GITHUB_TOKEN }}
46+
token: ${{ steps.app-token.outputs.token }}
4047
commit-message: 'chore: update payloads'
4148
sign-commits: true
4249
branch: 'chore/update-payloads'
@@ -58,11 +65,18 @@ jobs:
5865
- uses: ./.github/actions/setup-pnpm
5966
- name: cli all
6067
run: pnpm run tsc:types
68+
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 #v3.2.0
69+
id: app-token
70+
with:
71+
client-id: ${{ vars.APP_CLIENT_ID }}
72+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
73+
permission-contents: write
74+
permission-pull-requests: write
6175
- name: Create Pull Request
6276
id: cpr
6377
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 #v8.1.1
6478
with:
65-
token: ${{ secrets.GITHUB_TOKEN }}
79+
token: ${{ steps.app-token.outputs.token }}
6680
commit-message: 'chore: update types'
6781
sign-commits: true
6882
branch: 'chore/types'
@@ -92,11 +106,18 @@ jobs:
92106
| jq -r '.data' \
93107
> schema/github/schema.graphql
94108
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
109+
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 #v3.2.0
110+
id: app-token
111+
with:
112+
client-id: ${{ vars.APP_CLIENT_ID }}
113+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
114+
permission-contents: write
115+
permission-pull-requests: write
95116
- name: Create Pull Request
96117
id: cpr
97118
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 #v8.1.1
98119
with:
99-
token: ${{ secrets.GITHUB_TOKEN }}
120+
token: ${{ steps.app-token.outputs.token }}
100121
commit-message: 'chore: update GitHub GraphQL schema'
101122
sign-commits: true
102123
branch: 'chore/update-graphql-schema'

0 commit comments

Comments
 (0)