Skip to content

Commit f2a21b4

Browse files
committed
ci(coverage-refresh): add contents:write permission and document push caveat
Add 'permissions: contents: write' at the workflow top level so the coverage-refresh job is authorized to commit and push the updated coverage_map.json.gz back to master. Without this, the GITHUB_TOKEN has only read permissions in newer default permission settings. Also add a comment on the git push step noting that branch protection may still reject the default GITHUB_TOKEN and that a PAT or GitHub App with bypass-branch-protection permission may be needed.
1 parent f6d6bd1 commit f2a21b4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/coverage-refresh.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
- 'toolchain/mfc/test/cases.py'
1010
- 'src/**/*.fpp'
1111
workflow_dispatch:
12+
permissions:
13+
contents: write
1214
concurrency:
1315
group: coverage-refresh
1416
cancel-in-progress: true
@@ -31,6 +33,11 @@ jobs:
3133
git config user.email "mfc-bot@users.noreply.github.com"
3234
git add tests/coverage_map.json.gz
3335
git commit -m "test: refresh coverage map [skip ci]"
36+
# NOTE: pushing to a protected default branch requires a token or
37+
# GitHub App with bypass-branch-protection permission. The default
38+
# GITHUB_TOKEN may be rejected by branch protection rules; if so,
39+
# configure a PAT or App token with the `contents: write` scope and
40+
# pass it as `GITHUB_TOKEN` in the environment for this step.
3441
git push origin HEAD:master
3542
else
3643
echo "Coverage map unchanged."

0 commit comments

Comments
 (0)