Skip to content

Add branch pattern example to repository_ruleset documentation #2660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chemmi
Copy link

@chemmi chemmi commented May 15, 2025

The pattern can be confusing since Github API and UI differ in this point. This is just a clarification for the documentation.

See also: https://github.com/orgs/community/discussions/119797
See also: https://docs.github.com/en/rest/repos/rules#create-a-repository-ruleset

Resolves #ISSUE_NUMBER


Before the change?

  • Intuitively, the user would use the simple branch pattern main oder feat-* to include or exclude branches in the ruleset. The provider will crash with a 402 when applying the change:
Error: POST https://api.github.com/repos/ORG/REPO/rulesets: 422 Validation Failed [{Resource: Field: Code: Message:Invalid target patterns: 'main'}]

After the change?

  • The documentation suggests to use the required pattern, e.g. refs/heads/main, in this case.

See also the example in https://docs.github.com/en/rest/repos/rules#create-a-repository-ruleset which uses this pattern.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

The pattern can be confusing since Github API and UI differ in this point.

See also: https://github.com/orgs/community/discussions/119797
@nickfloyd nickfloyd moved this from 🆕 Triage to 👀 In review in 🧰 Octokit Active Jun 3, 2025
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