Fix GitHub CLI sample code about 'create a ruleset for a repository' #33821
Labels
content
This issue or pull request belongs to the Docs Content team
fix-internally
Triggers a workflow to copy the issue internally and close the current issue
rest
Content related to rest - overview.
Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28#create-a-repository-ruleset
What part(s) of the article would you like to see updated?
The current GitHub CLI sample code for creating a ruleset in a repository does not work correctly. The conditions field for targeting branches cannot be defined properly.
Currently, it is written as follows:
Problem
With this configuration, the conditions field remains empty, making it impossible to specify target branches in the created ruleset.
The correct way to write this is as follows:
changes:
ref_name[include[]]=refs/heads/main
→conditions[ref_name][include][]=refs/heads/main
ref_name[include[]]=refs/heads/master
→conditions[ref_name][include][]=refs/heads/master
ref_name[exclude[]]=refs/heads/dev*
→conditions[ref_name][exclude][]=refs/heads/dev*
Additional information
My GitHub CLI version is
gh version 2.52.0 (2024-06-24)
The text was updated successfully, but these errors were encountered: