Repository navigation
Conversation
curl ran with --fail --silent, so a 4xx exited 22 without a message, and the workflow-permissions body was JSON built by hand. gh api prints API errors, uses GH_TOKEN and builds the body from typed fields or the files main.py writes. The debug input now sets GH_DEBUG=api. Branch protection is set with a single REST PUT, which creates the protection when none exists, so the GraphQL create path, the repositoryId lookup and create-branch-protection-rule.graphql go. Closes #64 Closes #65 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #68 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What and why
curl --fail --silentcalls (workflow permissions, actions permissions, selected actions, branch protection) are replaced withgh api -X PUT.ghusesGH_TOKENand prints the API error on a 4xx, so the old silent exit 22 is gone. The workflow-permissions body is no longer JSON built by hand. It is sent as-f default_workflow_permissions=... -F can_approve_pull_request_reviews=....-Fturnstrue/falseinto JSON booleans. Any other value is sent as a string, and the API rejects it with a visible 422. The other calls send the files thatmain.pyalready writes, using--input. Thedebuginput now setsGH_DEBUG=apiinstead ofcurl --verbose.PUT /repos/{owner}/{repo}/branches/main/protectioncreates protection when none exists. The "is it protected?" check, therepositoryIdlookup and the GraphQLcreateBranchProtectionRulemutation are removed, leaving a single PUT. Nothing else usedcreate-branch-protection-rule.graphql, so it is deleted.main.py'sbranch_protection_rulesare removed.Noneis now written straight into the dict, andrequired_pull_request_reviewsis set directly instead of going throughdict.updateon a wrapper dict. The JSON it produces is unchanged.Testing
uv run --no-project --python 3.11 --with '.[dev]' pytest: 6 passed. The existing tests cover both branch-protection paths and needed no changes.action.ymlparses as YAML. Every step'srunscript was extracted and passesbash -n. shellcheck reports nothing new; its only finding is a pre-existing info-level SC2153 on the topics step.gh apicalls and creating protection on a branch that has none have not been run end to end. This repo's ownsettings.ymlsetssettings_protect_main_branch: false, so its own run will not exercise the branch-protection step either.The
general/PR-validation checks end instartup_failureon this fork because its Actions policy blocksschubergphilis/*actions. That problem already existed and is not caused by this change.Closes #64
Closes #65
Closes #68
🤖 Generated with Claude Code