Skip to content

Commit 001e032

Browse files
kim-emclaude
andcommitted
chore: migrate lean-pr-testing workflows to GitHub App
Replaces the `LEAN_PR_TESTING` personal access token with a GitHub App token generated via `actions/create-github-app-token`. This requires a GitHub App in the `leanprover` org installed on `lean4`. Part of the migration from personal bot accounts to GitHub Apps. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3fa53c5 commit 001e032

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

.github/workflows/build_template.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ jobs:
5454
shell: bash # there is no script body, so this is safe to "run" outside landrun.
5555
run: |
5656
# We just populate the env vars for this step to make them viewable in the logs
57+
- name: Generate lean-pr-testing app token
58+
id: lean-pr-testing-token
59+
shell: bash
60+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
61+
with:
62+
app-id: ${{ secrets.MATHLIB_LEAN_PR_TESTING_APP_ID }}
63+
private-key: ${{ secrets.MATHLIB_LEAN_PR_TESTING_PRIVATE_KEY }}
64+
owner: leanprover
65+
repositories: lean4
5766
- name: cleanup
5867
shell: bash # This *just* deletes old files, so is safe to run outside landrun.
5968
run: |
@@ -571,11 +580,12 @@ jobs:
571580
exit 1
572581
fi
573582
583+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
574584
- name: Post comments for lean-pr-testing-NNNN and batteries-pr-testing-NNNN branches
575585
if: always()
576586
shell: bash
577587
env:
578-
TOKEN: ${{ secrets.LEAN_PR_TESTING }}
588+
TOKEN: ${{ steps.lean-pr-testing-token.outputs.token }}
579589
GITHUB_CONTEXT: ${{ toJson(github) }}
580590
WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
581591
BUILD_OUTCOME: ${{ steps.build.outcome }}

.github/workflows/nightly_detect_failure.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,21 @@ jobs:
8080
- name: Cleanup workspace
8181
run: |
8282
sudo rm -rf -- *
83+
- name: Generate lean-pr-testing app token
84+
id: lean-pr-testing-token
85+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
86+
with:
87+
app-id: ${{ secrets.MATHLIB_LEAN_PR_TESTING_APP_ID }}
88+
private-key: ${{ secrets.MATHLIB_LEAN_PR_TESTING_PRIVATE_KEY }}
89+
owner: leanprover
90+
repositories: lean4
8391
# Checkout the Lean repository on 'nightly-with-mathlib'
92+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
8493
- name: Checkout Lean repository
8594
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8695
with:
8796
repository: leanprover/lean4
88-
token: ${{ secrets.LEAN_PR_TESTING }}
97+
token: ${{ steps.lean-pr-testing-token.outputs.token }}
8998
ref: nightly-with-mathlib
9099
# Merge the relevant nightly.
91100
- name: Fetch tags from 'lean4-nightly', and merge relevant nightly into 'nightly-with-mathlib'

0 commit comments

Comments
 (0)