Skip to content

feat: introduce gh-infra for declarative repository management#900

Open
ryo246912 wants to merge 1 commit intomainfrom
feat/introduce-gh-infra-15149192065187816130
Open

feat: introduce gh-infra for declarative repository management#900
ryo246912 wants to merge 1 commit intomainfrom
feat/introduce-gh-infra-15149192065187816130

Conversation

@ryo246912
Copy link
Copy Markdown
Owner

@ryo246912 ryo246912 commented Apr 25, 2026

Introduce gh-infra to manage GitHub repository settings and files declaratively.

  • Created dot_config/gh-infra/dotfiles.yaml for dotfiles repository management.
  • Added mise tasks for setup, plan, and apply in both root and config.toml.
  • Added zabrze abbreviations (ghip, ghia, ghii) in dot_config/zabrze/github.toml.
  • Updated setup.md and CLAUDE.md to replace setup-github with gh-infra.
  • Added gh-infra skill for AI agents in dot_config/rulesync.

PR created automatically by Jules for task 15149192065187816130 started by @ryo246912

1. 変更内容概要

GitHub リポジトリ設定を宣言的に管理するツール「gh-infra」を導入しました。以下の内容が追加/更新されています:

  • dot_config/gh-infra/dotfiles.yaml: dotfiles リポジトリの構成設定(マージポリシー、ルールセットなど)を定義
  • mise.tomldot_config/mise/config.toml: gh-infra のセットアップ・プラン・適用タスクを追加
  • dot_config/zabrze/github.toml: gh-infra 関連のショートカット定義(3つのプリセット)を追加
  • dot_config/rulesync/exact_dot_rulesync/skills/gh-infra/SKILL.md: AI エージェント向けのスキル定義を追加
  • setup.mdCLAUDE.md: セットアップワークフローの更新(setup-github コマンドを mise run gh-infra-setupmise run gh-infra-apply に置き換え)

2. 変更理由

GitHub リポジトリ設定を従来のコマンドから宣言的な設定ファイルベースの管理に移行することで、設定の再現性と追跡可能性を向上させます。gh-infra 拡張機能を活用し、リポジトリ設定とファイルの管理を自動化・スケーラブルにすることが狙いです。

3. 確認した項目

  • 新規追加ファイルはすべてドキュメント・設定ファイルのみで、コード実行ロジックを含まない
  • mise タスク定義により、既存の setup ワークフローとの統合が設定済み
  • 公開リポジトリ設定の詳細(マージ戦略、ルールセット、レビュー要件など)が YAML 形式で明確に定義されている

@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates gh-infra into the repository management workflow, enabling declarative configuration of GitHub repository settings. By automating the setup, planning, and application of these configurations through mise tasks and providing helpful CLI abbreviations, the change simplifies infrastructure maintenance and improves consistency across the development environment.

Highlights

  • gh-infra Integration: Introduced gh-infra for declarative management of GitHub repository settings, replacing the previous setup-github approach.
  • Task Automation: Added new mise tasks (gh-infra-setup, gh-infra-plan, gh-infra-apply) to streamline repository infrastructure management.
  • Documentation Updates: Updated setup.md and CLAUDE.md to reflect the new gh-infra workflow and added a new skill definition for AI agents.
  • Tooling Enhancements: Added zabrze abbreviations (ghip, ghia, ghii) to simplify command-line interaction with gh-infra.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

このプルリクエストでは、gh-infra を導入して GitHub リポジトリの設定を宣言的に管理する仕組みを追加し、関連する mise タスクやドキュメントを整備しています。レビューでは、個人リポジトリにおけるブランチ保護設定(承認必須数)がセルフマージを妨げる可能性や、グローバルな mise 設定および zabrze スニペットでの相対パス利用によるエラーの懸念が指摘されました。また、スタイルガイドに基づき、setup.md における不要なフォーマット変更(空行の追加)を控えるようフィードバックされています。

- type: required_signatures
- type: pull_request
parameters:
required_approving_review_count: 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

個人リポジトリにおいて required_approving_review_count: 1 を設定すると、自分自身でプルリクエストを承認できないため、マージがブロックされる可能性があります。他に承認できる共同作業者がいない場合は、この値を 0 に設定することを検討してください。

            required_approving_review_count: 0

Comment on lines +212 to +222
[tasks.gh-infra-setup]
description = "Install gh-infra extension"
run = "gh extension install babarot/gh-infra"

[tasks.gh-infra-plan]
description = "Run gh-infra plan"
run = "gh infra plan dot_config/gh-infra/"

[tasks.gh-infra-apply]
description = "Run gh-infra apply"
run = "gh infra apply dot_config/gh-infra/"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

これらのタスクはルートの mise.toml にも定義されており、重複しています。また、相対パス dot_config/gh-infra/ を使用しているため、リポジトリのルート以外(グローバルなコンテキスト)で実行するとパスが見つからずエラーになります。グローバル設定である dot_config/mise/config.toml からはこれらのタスクを削除し、リポジトリ内の mise.toml で管理することを推奨します。

Comment on lines +3 to +8
snippet = "gh infra plan dot_config/gh-infra/"
trigger = "ghip"

[[snippets]]
name = "gh infra apply"
snippet = "gh infra apply dot_config/gh-infra/"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

スニペット内で相対パス dot_config/gh-infra/ が使用されています。zabrze の略称は任意のディレクトリで展開されるため、リポジトリのルート以外では正しく動作しません。リポジトリの場所を特定できる絶対パスを使用するか、実行時にディレクトリをチェックするような仕組みを検討してください。

Comment thread setup.md
# Setup

## Mac

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

リポジトリのスタイルガイド(Rule 11)に基づき、不要なフォーマット変更(空行の追加)を避けてください。setup.md 全体でリストアイテム間に空行が追加されており、大きな churn となっています。意図的でない場合は元に戻すことを検討してください。

References
  1. 既存コメントや設定の意図を尊重し、キー順やフォーマットだけを理由にした不要な churn は避けてください。 (link)

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 25, 2026

📝 Walkthrough

Walkthrough

GitHub repository設定を宣言的に管理するためのgh-infra統合を追加しました。babarot/gh-infra GitHub CLI拡張のインストール、計画実行、適用実行のためのmiseタスクを新規作成、dot_config/gh-infra/dotfiles.yamlにてryo246912/dotfilesリポジトリの設定とルールセットを定義、スキルドキュメンテーションとスニペットプリセットを追加し、セットアップドキュメントを更新しました。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、gh-infraの導入という主な変更を明確かつ簡潔に要約しており、変更内容と完全に一致しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/introduce-gh-infra-15149192065187816130

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
dot_config/zabrze/github.toml (1)

1-14: gh.toml への統合検討

gh infragh 拡張のサブコマンドであり、既存の dot_config/zabrze/gh.tomlgh browse など)と同じカテゴリと解釈する余地があります。一方で、retrieved learning では「ツール固有のカテゴリファイルを新設してよい」とも示されているため、gh-infra を独立したツールとして扱う意図であれば現状で問題ありません。意図を明確化のうえ、gh.toml への統合か現状維持かをご判断ください。

なお、snippet 内の dot_config/gh-infra/ は相対パスのため、リポジトリルート以外で展開されると失敗します(mise run 経由での利用を想定しているなら問題なし)。

Based on learnings: zabrze abbreviations are organized by category in separate TOML files; new tool-specific category files are valid additions.

CLAUDE.md (1)

87-93: 初回 apply 前に plan の実行を推奨

宣言的な構成変更を直接 apply すると、意図しない設定(例:visibility やルールセット)が即時反映されます。安全のため、mise run gh-infra-plan を間に挟む手順をドキュメントに含めることを推奨します。

提案 diff
   ```bash
   # Initial setup (requires gh-infra extension)
   mise run gh-infra-setup
+  mise run gh-infra-plan
   mise run gh-infra-apply
</details>

</blockquote></details>

</blockquote></details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: Path: .coderabbit.yaml

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `b58a7366-a18a-4fdd-aa82-ea3e7baa8716`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between c1381fd18651563222f7c06c9698edac60d558ac and a6f6b6ee9e31beb8a8b05bc1ae1638f42f9c6017.

</details>

<details>
<summary>📒 Files selected for processing (8)</summary>

* `.rulesync/rules/CLAUDE.md`
* `CLAUDE.md`
* `dot_config/gh-infra/dotfiles.yaml`
* `dot_config/mise/config.toml`
* `dot_config/rulesync/exact_dot_rulesync/skills/gh-infra/SKILL.md`
* `dot_config/zabrze/github.toml`
* `mise.toml`
* `setup.md`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines +37 to +43
- type: pull_request
parameters:
required_approving_review_count: 1
dismiss_stale_reviews_on_push: true
require_code_owner_review: false
require_last_push_approval: true
required_review_thread_resolution: false
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

GitHub branch ruleset pull_request required_approving_review_count behavior for repository owner self-approval and bypass actors

💡 Result:

In GitHub branch rulesets, the required_approving_review_count rule under pull_request requires a specified number of approving reviews from users with write or admin permissions before a PR can be merged to the protected branch. Pull request authors, including repository owners, cannot approve their own PRs, regardless of their permissions. This is a built-in restriction to enforce meaningful peer review. Repository owners (admins) can bypass rulesets entirely if listed in the bypass_actors (e.g., actor_type "RepositoryRole" with appropriate ID, or "RepositoryAdmin" in org contexts), allowing direct pushes or merges without PRs or reviews. Bypass actors can ignore required_approving_review_count and other PR rules by selecting the bypass option during merge. For self-approval without bypass, it is not possible; owners must get reviews from others or use workflows/apps for auto-approval (though bot approvals may not always count toward the required count). Sources confirm: PR authors cannot self-approve (StackOverflow), docs describe review requirements from write/admin users excluding authors (,,), bypass for admins/actors (,).

Citations:


🏁 Script executed:

cat dot_config/gh-infra/dotfiles.yaml

Repository: ryo246912/dotfiles

Length of output: 1177


required_approving_review_count: 1 がこのリポジトリの所有者による PR マージをブロック

GitHub の仕様上、PR 作者は自身の PR を承認できません。このリポジトリは単独メンテナ構成ですが、required_approving_review_count: 1 を強制すると、所有者が作成した PR をマージできなくなります。

現在の設定に bypass_actors がないため、この制限は回避できない状態です。自動化 (Renovate / Jules / GitHub Actions など) による PR のマージが目的であれば問題ありませんが、手動マージが必要な場合は、ルールセットに bypass_actors を追加するか、承認要件を見直してください。

Comment on lines +212 to +222
[tasks.gh-infra-setup]
description = "Install gh-infra extension"
run = "gh extension install babarot/gh-infra"

[tasks.gh-infra-plan]
description = "Run gh-infra plan"
run = "gh infra plan dot_config/gh-infra/"

[tasks.gh-infra-apply]
description = "Run gh-infra apply"
run = "gh infra apply dot_config/gh-infra/"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 確認: 同一タスク名がリポジトリ内の複数 mise 設定で重複していないか
rg -nP '^\[tasks\.gh-infra-(setup|plan|apply)\]' --type=toml
# 確認: dot_config/mise/config.toml がチェズモイで ~/.config/mise/config.toml に展開される配置か
fd -a 'config.toml' dot_config/mise

Repository: ryo246912/dotfiles

Length of output: 383


🏁 Script executed:

# タスク内容の完全一致確認
echo "=== mise.toml tasks (lines 102-112) ===" && sed -n '102,112p' mise.toml
echo "" && echo "=== dot_config/mise/config.toml tasks (lines 212-222) ===" && sed -n '212,222p' dot_config/mise/config.toml

# チェズモイのデプロイ設定確認
echo "" && echo "=== chezmoi patterns ===" && find . -name '.chezmoi*' -o -name '*.tmpl' | head -20
echo "" && echo "=== dot_config directory structure ===" && find dot_config/mise -type f

Repository: ryo246912/dotfiles

Length of output: 1470


🏁 Script executed:

# chezmoiignore と chezmoi metadata
echo "=== .chezmoiignore ===" && cat .chezmoiignore | head -30
echo "" && echo "=== dot_config/mise/.chezmoi* files ===" && ls -la dot_config/mise/.chezmoi* 2>/dev/null || echo "No .chezmoi* metadata files found"
echo "" && echo "=== chezmoi source directory (if exists) ===" && ls -la .chezmoi/ 2>/dev/null | head -20 || echo "No .chezmoi directory"
echo "" && echo "=== Checking for exact_ prefix indicating exact copy ===" && ls -la dot_config/ | grep '^d' | head -20

Repository: ryo246912/dotfiles

Length of output: 1781


🏁 Script executed:

# mise.toml が chezmoiignore に含まれることを確認
grep -n "mise.toml" .chezmoiignore

# 相対パスが実際に機能するか確認するため、dot_config/gh-infra の存在確認
echo "" && echo "=== dot_config/gh-infra directory ===" && ls -la dot_config/gh-infra/ 2>/dev/null || echo "Directory exists or is checked"

# その他の mise config ファイルの内容を確認(タスク定義の有無)
echo "" && echo "=== Other mise config files (checking for gh-infra tasks) ===" && for f in dot_config/mise/config.*.toml; do echo "--- $f ---" && grep -c "gh-infra" "$f" || echo "0"; done

Repository: ryo246912/dotfiles

Length of output: 538


dot_config/mise/config.toml から gh-infra タスク定義を削除

同一タスク(gh-infra-setup/gh-infra-plan/gh-infra-apply)の定義が重複しています:

  • mise.toml(リポジトリ root):行 102-112
  • dot_config/mise/config.toml:行 212-222

.chezmoiignoremise.toml は除外されており、dot_config/mise/config.toml のみがチェズモイで ~/.config/mise/config.toml に展開されます。展開先の global 設定で dot_config/gh-infra/ という相対パスを参照すると、リポジトリ root 以外で実行した場合にパス解決に失敗します。

これらのタスクはリポジトリ root の mise.toml のみに定義すれば十分です。dot_config/mise/config.toml から削除してください。

削除対象
-[tasks.gh-infra-setup]
-description = "Install gh-infra extension"
-run         = "gh extension install babarot/gh-infra"
-
-[tasks.gh-infra-plan]
-description = "Run gh-infra plan"
-run         = "gh infra plan dot_config/gh-infra/"
-
-[tasks.gh-infra-apply]
-description = "Run gh-infra apply"
-run         = "gh infra apply dot_config/gh-infra/"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[tasks.gh-infra-setup]
description = "Install gh-infra extension"
run = "gh extension install babarot/gh-infra"
[tasks.gh-infra-plan]
description = "Run gh-infra plan"
run = "gh infra plan dot_config/gh-infra/"
[tasks.gh-infra-apply]
description = "Run gh-infra apply"
run = "gh infra apply dot_config/gh-infra/"

Comment on lines +7 to +13
### /gh-infra-plan

Run `gh infra plan` to see changes.

### /gh-infra-apply

Run `gh infra apply` to apply changes.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

コマンド表記の一貫性

mise.toml / dot_config/mise/config.toml / dot_config/zabrze/github.toml ではいずれも gh infra plan dot_config/gh-infra/gh infra apply dot_config/gh-infra/ と対象ディレクトリを明示しています。ここの gh infra plan / gh infra apply は引数なしのため、AI エージェントがそのままコピーして実行すると対象不明で失敗する可能性があります。同じパスを明示するか、mise run gh-infra-plan / mise run gh-infra-apply を案内する方が一貫します。

提案 diff
 ### /gh-infra-plan

-Run `gh infra plan` to see changes.
+Run `mise run gh-infra-plan` (or `gh infra plan dot_config/gh-infra/`) to see changes.

 ### /gh-infra-apply

-Run `gh infra apply` to apply changes.
+Run `mise run gh-infra-apply` (or `gh infra apply dot_config/gh-infra/`) to apply changes.

Comment thread setup.md
```
setup-git-gpg
```
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

コードブロックに言語指定を追加(markdownlint MD040)

静的解析(markdownlint-cli2)がライン 162 と 185 でフェンスドコードブロックに言語指定がないことを警告しています。sh 等の指定を追加してください。

提案 diff
-    ```
+    ```sh
     setup-git-gpg
     ```

(185 行目側も同様に sh を追加)

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 162-162: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Comment thread setup.md
Comment on lines +377 to +380
### gh-infra setup

Run `mise run gh-infra-setup` to install the gh-infra extension.
Use `mise run gh-infra-plan` and `mise run gh-infra-apply` to manage repository settings.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

節の配置・言語の不整合

このセクションは Windows セットアップ末尾に追加されていますが、gh-infra は macOS/Windows 共通のはずで、Mac セクション側からは参照されていません。また、本ドキュメントは日本語で書かれているのに本節のみ英語で、トーンも他と揃っていません。CLAUDE.md 側と同様に gh-infra-plan への言及も欠けています。

推測ですが、共通工程としてプラットフォーム非依存な位置(## Mac## Windows の前 or 別セクション)に置く方が自然です。

提案 diff(言語・plan 追記)
 ### gh-infra setup

-Run `mise run gh-infra-setup` to install the gh-infra extension.
-Use `mise run gh-infra-plan` and `mise run gh-infra-apply` to manage repository settings.
+- [ ] gh-infra 拡張のインストール
+  ```sh
+  mise run gh-infra-setup
+  ```
+- [ ] リポジトリ設定の差分確認・適用
+  ```sh
+  mise run gh-infra-plan
+  mise run gh-infra-apply
+  ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant