コマンド

init - 設定ファイルの初期化

対話形式で設定ファイルを作成します。

# .github/repo-settings.yaml を対話形式で作成
gh repo-settings init

# 出力先を指定
gh repo-settings init -o config.yaml

# 既存ファイルを上書き
gh repo-settings init -f

export - リポジトリ設定のエクスポート

現在の GitHub リポジトリ設定を YAML 形式でエクスポートします。

# 標準出力にエクスポート
gh repo-settings export

# 単一ファイルにエクスポート
gh repo-settings export -s .github/repo-settings.yaml

# ディレクトリにエクスポート(複数ファイル)
gh repo-settings export -d .github/repo-settings/

# シークレット名を含める
gh repo-settings export -s settings.yaml --include-secrets

# 特定のリポジトリからエクスポート
gh repo-settings export -r owner/repo -s settings.yaml

plan - 変更のプレビュー

設定を検証し、適用せずに計画された変更を表示します。

# すべての変更をプレビュー(デフォルトパスを使用)
gh repo-settings plan

# 設定ファイルを指定
gh repo-settings plan -c custom-config.yaml

# ディレクトリ設定でプレビュー
gh repo-settings plan -d .github/repo-settings/

# 現在のGitHub設定を表示(デバッグ用)
gh repo-settings plan --show-current

# シークレットをチェック
gh repo-settings plan --secrets

# 環境変数をチェック
gh repo-settings plan --env

# 設定にない変数/シークレットの削除を表示
gh repo-settings plan --env --secrets --sync

Status Check 検証

plan 実行時、ブランチ保護ルールの status_checks 名が .github/workflows/ ファイルのジョブ名と一致するか自動で検証します:

⚠ status check lint not found in workflows ⚠ status check test not found in workflows Available checks: build, golangci-lint, Run tests

apply - 変更の適用

YAML 設定を GitHub リポジトリに適用します。

# 変更を適用(デフォルトパスを使用)
gh repo-settings apply

# 確認なしで自動承認
gh repo-settings apply -y

# 設定ファイルを指定
gh repo-settings apply -c custom-config.yaml

# ディレクトリから適用
gh repo-settings apply -d .github/repo-settings/

# 変数とシークレットを適用
gh repo-settings apply --env --secrets

# 同期モード: 設定にない変数/シークレットを削除
gh repo-settings apply --env --secrets --sync

グローバルオプション

オプション 説明
-v, --verbose デバッグ出力を表示
-q, --quiet エラーのみ表示
-r, --repo <owner/name> 対象リポジトリ(デフォルト: 現在のリポジトリ)