Repository navigation
Check GitHub push permissions before every release - #86
Merged
dblock merged 1 commit intoNov 20, 2026
Merged
Conversation
Add Workflow::GitHubPermissions to the preflight on GitHub Actions. It runs git push --dry-run to the default branch, which fails without contents: write while sending no objects, then reads the repository rules for the default branch and the vVERSION tag. Rules that would reject the release push fail unless the ruleset reports the token can bypass it; classic branch protection, which needs admin access to read, produces a warning. The preflight step receives GH_TOKEN in both interfaces. The dry-run job now captures the release context and keeps checkout credentials so it can check the same branch, tag, and push access as a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Gr21hZDQo5axDMuFgzL6s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #85.
Summary
Extends the per-release preflight from #85 with GitHub checks, so a token that cannot push the release fails before anything is published. Today the release publishes the gem before pushing Git, so a rejected push left a published gem without its tag or release commit.
git push --dry-run --porcelain origin HEAD:refs/heads/<default>. GitHub requires push access to start a push, so this fails withoutcontents: write; a dry run sends no objects and changes no refs.rules/branches/<default>and tag rulesets matchingrefs/tags/vVERSION(including organization rulesets). Branch rules requiring pull requests, status checks, signed commits, deployments, a merge queue, or restricting updates, and tag rules restricting creation or requiring signatures, fail the preflight with the ruleset name, unless the ruleset reportscurrent_user_can_bypassasalwaysorexempt.INPUT_VERSIONor the capturedGEMSPEC_VERSION; without either, tag rules are skipped. The checks run only on GitHub Actions.GH_TOKENin both interfaces. The dry-run job now also captures the release context (default branch, clean and current checkout, version) and keeps checkout credentials sogit push --dry-runcan authenticate. Its environment matches the release job's.gh apistub now answers only release endpoints, so the new rules requests see a realistic 404.Limits, documented: tag-rule matching uses
File.fnmatchagainst GitHub's include/exclude patterns, and rules that only constrain metadata (commit message or author patterns) are not evaluated.Validation
PARALLEL_TEST_PROCESSORS=4 bundle exec rake(460 examples, 0 failures; RuboCop no offenses) andactionlint. The composite and workflow integration suites run the new check against their local remote.Authored by an AI (Claude) acting on behalf of @dblock.
🤖 Generated with Claude Code
https://claude.ai/code/session_011Gr21hZDQo5axDMuFgzL6s