Skip to content

fix(ci): correct GitHub ruleset API parameter names#17

Merged
ajitgunturi merged 2 commits into
mainfrom
ci/fix-branch-protection-script
Mar 20, 2026
Merged

fix(ci): correct GitHub ruleset API parameter names#17
ajitgunturi merged 2 commits into
mainfrom
ci/fix-branch-protection-script

Conversation

@ajitgunturi
Copy link
Copy Markdown
Collaborator

Summary

  • Fix strict_status_checks_policystrict_required_status_checks_policy
  • Add required allowed_merge_methods and required_review_thread_resolution params to pull_request rule
  • Add do_not_enforce_on_create param to status checks rule

Test plan

  • Ran the script successfully against the repo — ruleset created with correct parameters

🤖 Generated with Claude Code

Align pull_request and required_status_checks rule params with
the actual GitHub rulesets API schema.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 07ee9de588

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{
"type": "pull_request",
"parameters": {
"allowed_merge_methods": ["squash", "merge"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the repository's enabled merge methods

Hard-coding allowed_merge_methods to squash and merge changes more than the API shape here: it also disables rebase for every repo that runs this script. GitHub's ruleset docs note that a pull-request rule will block merging if the ruleset requires a method the repository settings don't allow, so any repo configured for rebase-only merges (or that later switches to rebase-only) becomes unmergeable after this script runs. This should be derived from the repo's actual merge settings or include rebase as well.

Useful? React with 👍 / 👎.

"parameters": {
"strict_status_checks_policy": true,
"strict_required_status_checks_policy": true,
"do_not_enforce_on_create": false,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow branch creation when status checks are required

Setting do_not_enforce_on_create to false makes the required build-and-test check apply even when refs/heads/main is being created. On a fresh repo, or if main ever has to be recreated, that is a chicken-and-egg failure: the branch cannot be created because the check has not run yet, and the check cannot run until the branch exists. This is especially risky in a setup script whose job is to bootstrap protection on a repository.

Useful? React with 👍 / 👎.

Actor ID 5 (RepositoryRole: admin) can merge without waiting for
approval reviews. All other contributors still require 1 approval
and passing CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ajitgunturi ajitgunturi merged commit 96d5a38 into main Mar 20, 2026
2 checks passed
@ajitgunturi ajitgunturi deleted the ci/fix-branch-protection-script branch March 20, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant