Linux command
gh-ruleset 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List rulesets in the current repository
gh ruleset list
List rulesets including those inherited from parents
gh ruleset list --parents
View a specific ruleset
gh ruleset view [ruleset_id]
View a ruleset in the web browser
gh ruleset view [ruleset_id] --web
Check which rules apply to a given branch
gh ruleset check [branch]
List organization-level rulesets
gh ruleset list --org [organization]
说明
gh ruleset manages GitHub repository and organization rulesets, which define branch and tag protection rules, required status checks, required reviews, deployment protections, and merge requirements. Rulesets are a more expressive replacement for classic branch protection rules. A ruleset can target multiple branches or tags using fnmatch patterns, apply across all repositories in an organization, and define bypass actors. The check command evaluates which rules currently apply to a specific branch, useful for understanding why a push or merge was rejected. Creating and editing rulesets is not supported directly from the CLI; use the GitHub web UI or the REST API via gh api.
参数
- -R, --repo _\HOST/\OWNER/REPO_
- Select another repository using the \HOST/\OWNER/REPO format.
- -o, --org _organization_
- Operate on an organization's rulesets instead of a repository's.
- -p, --parents
- Include inherited rulesets from parent organizations (list/view).
- -L, --limit _int_
- Maximum number of rulesets to list (default 30).
- -w, --web
- Open the ruleset in the browser (view).
- -t, --default-branch
- Check rules for the repository's default branch (check).
FAQ
What is the gh-ruleset command used for?
gh ruleset manages GitHub repository and organization rulesets, which define branch and tag protection rules, required status checks, required reviews, deployment protections, and merge requirements. Rulesets are a more expressive replacement for classic branch protection rules. A ruleset can target multiple branches or tags using fnmatch patterns, apply across all repositories in an organization, and define bypass actors. The check command evaluates which rules currently apply to a specific branch, useful for understanding why a push or merge was rejected. Creating and editing rulesets is not supported directly from the CLI; use the GitHub web UI or the REST API via gh api.
How do I run a basic gh-ruleset example?
Run `gh ruleset list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -R, --repo _\HOST/\OWNER/REPO_ do in gh-ruleset?
Select another repository using the \HOST/\OWNER/REPO format.