LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gh-rs

View GitHub repository rulesets (alias for gh ruleset)

TLDR

List rulesets for the current repository
$ gh rs list
copy
List rulesets for a different repository, including inherited ones
$ gh rs list --repo [owner/repo] --parents
copy
List organization-wide rulesets
$ gh rs list --org [org-name]
copy
View a specific ruleset by ID
$ gh rs view [43]
copy
Open a ruleset in the web browser
$ gh rs view [43] --web
copy
Check rules that apply to the current branch
$ gh rs check
copy
Check rules that apply to the default branch of another repository
$ gh rs check --default --repo [owner/repo]
copy

SYNOPSIS

gh rs command [flags]

DESCRIPTION

gh rs is the built-in alias for gh ruleset, part of the official GitHub CLI. Rulesets let repository and organization admins enforce rules (required reviews, status checks, branch naming, force-push restrictions, etc.) on branches and tags. This command group is read-only: it lists and inspects rulesets and shows which rules apply to a given branch, but does not create or edit rulesets.

PARAMETERS

list

List rulesets for a repository or organization.
view [ruleset-id]
View information about a ruleset. Prompts interactively if no ID is given.
check [branch]
View rules that would apply to a given branch. Uses the current branch if none is given.
-R, --repo [HOST/]OWNER/REPO
Select another repository instead of the current one.

LIST FLAGS

-L, --limit int

Maximum number of rulesets to list (default 30).
-o, --org string
List organization-wide rulesets. Requires the admin:org token scope.
-p, --parents
Include rulesets configured at higher levels that also apply (default true).
-w, --web
Open the list of rulesets in the web browser.

VIEW/CHECK FLAGS

-o, --org string

Organization name, when the ID given to view is an organization-level ruleset.
--default
With check, view rules on the repository's default branch.
-w, --web
Open the ruleset or branch rules page in the web browser.

INSTALL

sudo apt install gh
copy
sudo dnf install gh
copy
sudo pacman -S github-cli
copy
sudo apk add github-cli
copy
sudo zypper install gh
copy
brew install gh
copy
nix profile install nixpkgs#gh
copy

CAVEATS

Read-only: rulesets themselves are created and edited on GitHub.com or via the API, not through gh ruleset. Listing organization-wide rulesets with --org requires a token with the admin:org scope, obtainable via gh auth refresh -s admin:org.

SEE ALSO

gh(1), gh-repo(1)

RESOURCES

Copied to clipboard
Kai