Skip to content

Commit 03ffba5

Browse files
committed
ci(coverage): push refreshed map via classic PAT (CACHE_PUSH_TOKEN)
GitHub Apps cannot bypass the require-PR ruleset rule for direct pushes (documented limitation), so the app-token approach was abandoned. A classic PAT from an org-owner authenticates as a user with OrganizationAdmin bypass, which IS honored. Verified via a smoke-test that pushed to protected master with require-PR active. persist-credentials:false (already on master) ensures the PAT is the identity used, not GITHUB_TOKEN.
1 parent 80c485e commit 03ffba5

1 file changed

Lines changed: 12 additions & 19 deletions

File tree

.github/workflows/coverage-refresh.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,31 @@ jobs:
2424
steps:
2525
# persist-credentials: false stops actions/checkout from configuring the
2626
# default GITHUB_TOKEN as an http.extraheader, which otherwise OVERRIDES the
27-
# app-token credentials embedded in the push URL below — making the push
28-
# authenticate as github-actions[bot] (not a ruleset bypass actor) and get
29-
# rejected by the require-PR rule. With it off, the app token is used and the
30-
# mfc-map-bot bypass applies.
27+
# token embedded in the push URL below — making the push authenticate as
28+
# github-actions[bot] (which cannot bypass the require-PR rule) instead of
29+
# the CACHE_PUSH_TOKEN identity.
3130
- uses: actions/checkout@v4
3231
with: { clean: false, persist-credentials: false }
3332
- name: Build + collect coverage map (SLURM)
3433
run: bash .github/scripts/submit-slurm-job.sh .github/workflows/common/coverage-refresh.sh cpu none phoenix
35-
# Mint a short-lived GitHub App installation token. The app is on the master
36-
# ruleset's bypass list (Integration actor), so its push satisfies the
37-
# "require pull request" rule that rejects the default GITHUB_TOKEN.
38-
- name: Generate app token
39-
id: app-token
40-
uses: actions/create-github-app-token@v3
41-
with:
42-
app-id: ${{ secrets.MAP_BOT_APP_ID }}
43-
private-key: ${{ secrets.MAP_BOT_APP_PRIVATE_KEY }}
4434
- name: Commit refreshed map
4535
env:
46-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
36+
CACHE_PUSH_TOKEN: ${{ secrets.CACHE_PUSH_TOKEN }}
4737
run: |
4838
if ! git diff --quiet tests/coverage_map.json.gz; then
49-
git config user.name "mfc-map-bot[bot]"
50-
git config user.email "mfc-map-bot[bot]@users.noreply.github.com"
39+
git config user.name "mfc-bot"
40+
git config user.email "mfc-bot@users.noreply.github.com"
5141
git add tests/coverage_map.json.gz
5242
# --no-verify: this bot commit stages only the binary coverage map; it
5343
# must not run the repo pre-commit hook (./mfc.sh precheck/spelling),
5444
# which is for source changes and aborts the commit on the runner.
5545
git commit --no-verify -m "test: refresh coverage map [skip ci]"
56-
# Push to master via the app installation token. The app is a bypass
57-
# actor on the master ruleset, so the require-PR rule does not reject it.
58-
git push "https://x-access-token:${GH_TOKEN}@github.com/MFlowCode/MFC.git" HEAD:master
46+
# Push to master with CACHE_PUSH_TOKEN, a classic PAT from an org-owner
47+
# account. GitHub Apps cannot bypass the require-PR ruleset rule for
48+
# direct pushes, but a PAT authenticates as the user (OrganizationAdmin),
49+
# which IS an honored bypass actor. persist-credentials:false above
50+
# ensures this token is actually used for the push.
51+
git push "https://x-access-token:${CACHE_PUSH_TOKEN}@github.com/MFlowCode/MFC.git" HEAD:master
5952
else
6053
echo "Coverage map unchanged."
6154
fi

0 commit comments

Comments
 (0)