Skip to content

Commit e93acb6

Browse files
MaxGhenisclaude
andauthored
Mint GitHub App token in push workflow (#551)
Replace the expired POLICYENGINE_GITHUB PAT with a short-lived GitHub App token (APP_ID / APP_PRIVATE_KEY) in the versioning and Deploy jobs. Each job generates its own token since App tokens do not cross job boundaries. Matches the pattern in policyengine-core PR #470 and microdf PR #296. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b7677d4 commit e93acb6

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/push.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ jobs:
2626
&& !(github.event.head_commit.message == 'Update PolicyEngine Canada')
2727
runs-on: ubuntu-latest
2828
steps:
29+
- name: Generate GitHub App token
30+
id: app-token
31+
uses: actions/create-github-app-token@v1
32+
with:
33+
app-id: ${{ secrets.APP_ID }}
34+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
2935
- name: Checkout repo
3036
uses: actions/checkout@v4
3137
with:
32-
token: ${{ secrets.POLICYENGINE_GITHUB }}
38+
token: ${{ steps.app-token.outputs.token }}
3339
- name: Setup Python
3440
uses: actions/setup-python@v5
3541
with:
@@ -49,6 +55,8 @@ jobs:
4955
committer_name: Github Actions[bot]
5056
author_name: Github Actions[bot]
5157
message: Update PolicyEngine Canada
58+
github_token: ${{ steps.app-token.outputs.token }}
59+
fetch: false
5260
Test:
5361
runs-on: ${{ matrix.os }}
5462
if: |
@@ -111,13 +119,17 @@ jobs:
111119
(github.repository == 'PolicyEngine/policyengine-canada')
112120
&& (github.event.head_commit.message == 'Update PolicyEngine Canada')
113121
runs-on: ubuntu-latest
114-
env:
115-
GH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB }}
116122
steps:
123+
- name: Generate GitHub App token
124+
id: app-token
125+
uses: actions/create-github-app-token@v1
126+
with:
127+
app-id: ${{ secrets.APP_ID }}
128+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
117129
- name: Checkout repo
118130
uses: actions/checkout@v4
119131
with:
120-
token: ${{ secrets.POLICYENGINE_GITHUB }}
132+
token: ${{ steps.app-token.outputs.token }}
121133
- name: Setup Python
122134
uses: actions/setup-python@v5
123135
with:
@@ -130,4 +142,4 @@ jobs:
130142
- name: Update API
131143
run: python .github/update_api.py
132144
env:
133-
GITHUB_TOKEN: ${{ secrets.POLICYENGINE_GITHUB }}
145+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Migrated push workflow from the expired `POLICYENGINE_GITHUB` PAT to a short-lived GitHub App token (`APP_ID` / `APP_PRIVATE_KEY`), so the `versioning` job can push the "Update PolicyEngine Canada" commit that triggers Test, Publish, and Deploy. Matches the pattern already used by policyengine-core, policyengine-us, and microdf.

0 commit comments

Comments
 (0)