Skip to content

Commit 1ff8919

Browse files
authored
ci: create pre-commit autoupdate PRs with a GitHub App token (#13)
Use a GitHub App token (actions/create-github-app-token) for checkout and create-pull-request instead of the default GITHUB_TOKEN. PRs opened with GITHUB_TOKEN do not trigger pull_request workflows, so the required CodeQL and dependency-review checks never ran and the PRs stayed blocked. With an App token the PRs trigger CI and become mergeable automatically.
1 parent ed5f2dc commit 1ff8919

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/pre-commit-autoupdate.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ permissions: 'read-all'
1010
jobs:
1111
update:
1212
runs-on: 'ubuntu-latest'
13-
permissions:
14-
contents: 'write'
15-
pull-requests: 'write'
1613
steps:
14+
- name: 'Generate app token'
15+
id: 'app-token'
16+
uses: 'actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1' # v3.2.0
17+
with:
18+
app-id: '${{ vars.LF_AUTOMATION_APP_ID }}'
19+
private-key: '${{ secrets.LF_AUTOMATION_APP_PRIVATE_KEY }}'
20+
1721
- name: 'Checkout repository'
1822
uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2
23+
with:
24+
token: '${{ steps.app-token.outputs.token }}'
1925

2026
- name: 'Set up Python'
2127
uses: 'actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405' # v6.2.0
@@ -31,6 +37,7 @@ jobs:
3137
- name: 'Create Pull Request'
3238
uses: 'peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1' # v8.1.1
3339
with:
40+
token: '${{ steps.app-token.outputs.token }}'
3441
commit-message: 'chore: update pre-commit hooks'
3542
title: 'chore: update pre-commit hooks'
3643
body: 'Automatic pre-commit hook version update.'

0 commit comments

Comments
 (0)