Skip to content

Commit 1cd6165

Browse files
authored
ci: use app token for upgrade PR (#1449)
## Summary - use `actions/create-github-app-token` for the upgrade dependency PR cleanup and creation steps - stop relying on default `GITHUB_TOKEN` write scopes for `peter-evans/create-pull-request` - disable persisted checkout credentials in the workflow ## Verification - `ruby -e 'require "yaml"; YAML.load_file(ARGV.fetch(0)); puts "yaml ok"' .github/workflows/upgrade-deps.yml`\n- `zizmor .github/workflows/upgrade-deps.yml`
1 parent 2a41ea1 commit 1cd6165

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/upgrade-deps.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
if: github.event.repository.fork == false
1313
runs-on: ubuntu-latest
1414
permissions:
15-
contents: write
16-
pull-requests: write
1715
actions: read
1816
id-token: write
1917
steps:
2018
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19+
with:
20+
persist-credentials: false
2121
- uses: ./.github/actions/clone
2222

2323
- name: Set up metadata directory
@@ -252,9 +252,15 @@ jobs:
252252
echo 'UPGRADE_DEPS_BODY_EOF'
253253
} >> "${GITHUB_OUTPUT}"
254254
255+
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
256+
id: app-token
257+
with:
258+
client-id: ${{ secrets.APP_ID }}
259+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
260+
255261
- name: Close and delete previous PR
256262
env:
257-
GH_TOKEN: ${{ secrets.AUTO_UPDATE_BRANCH_TOKEN }}
263+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
258264
run: |
259265
# Find PR with the deps/upstream-update branch
260266
PR_NUMBER=$(gh pr list --head deps/upstream-update --json number --jq '.[0].number')
@@ -273,7 +279,6 @@ jobs:
273279
branch: deps/upstream-update
274280
title: 'feat(deps): upgrade upstream dependencies'
275281
sign-commits: true
276-
token: ${{ secrets.AUTO_UPDATE_BRANCH_TOKEN }}
277-
branch-token: ${{ secrets.GITHUB_TOKEN }}
282+
token: ${{ steps.app-token.outputs.token }}
278283
body: ${{ steps.pr-content.outputs.body }}
279284
commit-message: ${{ steps.pr-content.outputs.commit-message }}

0 commit comments

Comments
 (0)