LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gh-ruleset

Manage GitHub repository and organization rulesets

TLDR

List rulesets in the current repository
$ gh ruleset list
copy
List rulesets including those inherited from parents
$ gh ruleset list --parents
copy
View a specific ruleset by ID
$ gh ruleset view [ruleset_id]
copy
View a ruleset in the web browser
$ gh ruleset view [ruleset_id] --web
copy
Check which rules apply to a given branch
$ gh ruleset check [branch]
copy
List organization-level rulesets
$ gh ruleset list --org [organization]
copy

SYNOPSIS

gh ruleset command [flags]

DESCRIPTION

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.

PARAMETERS

-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).

SUBCOMMANDS

check [branch]

Show rules that apply to a given branch in the current repository.
list
List rulesets for a repository or organization.
view [ruleset-id]
View information about a ruleset. Without an ID, runs interactively.

CAVEATS

Requires authentication via gh auth login. Viewing organization rulesets requires organization permissions. Rules defined at the enterprise or organization level may not appear unless --parents is used.

SEE ALSO

gh(1), gh-api(1), gh-repo(1), gh-auth(1)

Copied to clipboard
Kai