Skip to content

Commit 51350af

Browse files
committed
chore: migrate update-dependencies workflows to GitHub App (leanprover-community#34750)
This PR migrates `update_dependencies.yml` and `update_dependencies_zulip.yml` from using a personal access token (`UPDATE_DEPENDENCIES_TOKEN` from `leanprover-community-mathlib4-bot`) to using a GitHub App. 🤖 Prepared with Claude Code
1 parent f2ef43d commit 51350af

2 files changed

Lines changed: 28 additions & 5 deletions

File tree

.github/workflows/update_dependencies.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@ jobs:
1212
env:
1313
BRANCH_NAME: "update-dependencies-bot-use-only"
1414
steps:
15+
- name: Generate app token
16+
id: app-token
17+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
18+
with:
19+
app-id: ${{ secrets.MATHLIB_UPDATE_DEPENDENCIES_APP_ID }}
20+
private-key: ${{ secrets.MATHLIB_UPDATE_DEPENDENCIES_PRIVATE_KEY }}
21+
22+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
1523
- name: Checkout repository
1624
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1725
with:
1826
fetch-depth: 0
19-
token: "${{ secrets.UPDATE_DEPENDENCIES_TOKEN }}"
27+
token: ${{ steps.app-token.outputs.token }}
2028

2129
- name: Configure Lean
2230
uses: leanprover/lean-action@c544e89643240c6b398f14a431bcdc6309e36b3e # v1.4.0
@@ -116,8 +124,7 @@ jobs:
116124
if: ${{ steps.pr-title.outcome == 'success' }}
117125
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
118126
with:
119-
token: "${{ secrets.UPDATE_DEPENDENCIES_TOKEN }}"
120-
author: "leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com>"
127+
token: ${{ steps.app-token.outputs.token }}
121128
commit-message: "chore: update Mathlib dependencies ${{ env.timestamp }}"
122129
# this branch is referenced in update_dependencies_zulip.yml
123130
branch: ${{ env.BRANCH_NAME }}

.github/workflows/update_dependencies_zulip.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,19 @@ jobs:
3333
delimiter="EOF"
3434
printf 'changes<<%s\n%s\n%s' "$delimiter" "${message}" "$delimiter"
3535
36+
- name: Generate app token
37+
id: app-token
38+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
39+
with:
40+
app-id: ${{ secrets.MATHLIB_UPDATE_DEPENDENCIES_APP_ID }}
41+
private-key: ${{ secrets.MATHLIB_UPDATE_DEPENDENCIES_PRIVATE_KEY }}
42+
43+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
3644
- name: Construct message
3745
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
3846
id: construct_message
3947
with:
40-
github-token: ${{ secrets.UPDATE_DEPENDENCIES_TOKEN }}
48+
github-token: ${{ steps.app-token.outputs.token }}
4149
result-encoding: string
4250
script: |
4351
const owner = context.repo.owner, repo = context.repo.repo;
@@ -99,11 +107,19 @@ jobs:
99107
delimiter="EOF"
100108
printf 'changes<<%s\n%s\n%s' "$delimiter" "${message}" "$delimiter"
101109
110+
- name: Generate app token
111+
id: app-token
112+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
113+
with:
114+
app-id: ${{ secrets.MATHLIB_UPDATE_DEPENDENCIES_APP_ID }}
115+
private-key: ${{ secrets.MATHLIB_UPDATE_DEPENDENCIES_PRIVATE_KEY }}
116+
117+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
102118
- name: Construct success message
103119
id: construct_message
104120
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
105121
with:
106-
github-token: ${{ secrets.UPDATE_DEPENDENCIES_TOKEN }}
122+
github-token: ${{ steps.app-token.outputs.token }}
107123
result-encoding: string
108124
script: |
109125
const owner = context.repo.owner, repo = context.repo.repo;

0 commit comments

Comments
 (0)