ci: use admin token for cache push to bypass branch protection#1321
ci: use admin token for cache push to bypass branch protection#1321sbryngelson merged 2 commits intoMFlowCode:masterfrom
Conversation
Claude Code ReviewHead SHA: 88a1af7 Files changed:
Summary:
Findings: Token embedded in push URL ( git push https://x-access-token:${CACHE_PUSH_TOKEN}@github.com/MFlowCode/MFC.git HEAD:refs/heads/masterGitHub Actions masks secret values in logs, but a token embedded in a URL can sometimes appear unmasked in git error messages, process lists, or if git surfaces the remote URL in diagnostics. A safer pattern avoids putting the token in a URL that git might cache or echo: git remote set-url origin https://x-access-token:${CACHE_PUSH_TOKEN}@github.com/MFlowCode/MFC.git
git push origin HEAD:refs/heads/master…or using No guard for unset if [ -z "${CACHE_PUSH_TOKEN}" ]; then
echo "::error::CACHE_PUSH_TOKEN secret is not set — cannot push cache to master."
exit 1
fi
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe 📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can customize the tone of the review comments and chat replies.Configure the |
There was a problem hiding this comment.
Pull request overview
Updates the CI rebuild-cache workflow so the automated coverage-cache commit can be pushed to master despite branch protection rulesets, by switching the push authentication from the default GITHUB_TOKEN to an admin-scoped secret token.
Changes:
- Exposes
CACHE_PUSH_TOKENto the “Commit Cache to Master” step via workflow secrets. - Pushes the cache commit to
masterusing an authenticated HTTPS URL with the admin token. - Adds
--no-verifyto the cache commit (skipping pre-commit hooks for this automated commit).
| # Push using admin token to bypass branch protection rulesets. | ||
| # The default GITHUB_TOKEN lacks the Repository Admin role needed | ||
| # to push directly to master. | ||
| git push https://x-access-token:${CACHE_PUSH_TOKEN}@github.com/MFlowCode/MFC.git HEAD:refs/heads/master |
| CACHE_PUSH_TOKEN: ${{ secrets.CACHE_PUSH_TOKEN }} | ||
| run: | |
| echo "Coverage cache unchanged." | ||
| else | ||
| git commit -m "Regenerate gcov coverage cache [skip ci]" | ||
| git commit --no-verify -m "Regenerate gcov coverage cache [skip ci]" |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1321 +/- ##
==========================================
- Coverage 45.12% 45.01% -0.11%
==========================================
Files 70 70
Lines 20554 20562 +8
Branches 1962 1962
==========================================
- Hits 9274 9255 -19
- Misses 10152 10179 +27
Partials 1128 1128 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
rebuild-cachejob's push to master is blocked by GitHub repository rulesets (GH013). The defaultGITHUB_TOKENdoesn't have the Repository Admin role needed to bypass branch protection.CACHE_PUSH_TOKENsecret (admin-scoped) for the push step only.Follows up on #1320.
Test plan
rebuild-cachejob pushes cache to master successfully🤖 Generated with Claude Code