feat: introduce gh-infra for declarative repository management#900
feat: introduce gh-infra for declarative repository management#900
Conversation
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Summary of ChangesHello, 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
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
このプルリクエストでは、gh-infra を導入して GitHub リポジトリの設定を宣言的に管理する仕組みを追加し、関連する mise タスクやドキュメントを整備しています。レビューでは、個人リポジトリにおけるブランチ保護設定(承認必須数)がセルフマージを妨げる可能性や、グローバルな mise 設定および zabrze スニペットでの相対パス利用によるエラーの懸念が指摘されました。また、スタイルガイドに基づき、setup.md における不要なフォーマット変更(空行の追加)を控えるようフィードバックされています。
| - type: required_signatures | ||
| - type: pull_request | ||
| parameters: | ||
| required_approving_review_count: 1 |
| [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/" |
| snippet = "gh infra plan dot_config/gh-infra/" | ||
| trigger = "ghip" | ||
|
|
||
| [[snippets]] | ||
| name = "gh infra apply" | ||
| snippet = "gh infra apply dot_config/gh-infra/" |
| # Setup | ||
|
|
||
| ## Mac | ||
|
|
There was a problem hiding this comment.
リポジトリのスタイルガイド(Rule 11)に基づき、不要なフォーマット変更(空行の追加)を避けてください。setup.md 全体でリストアイテム間に空行が追加されており、大きな churn となっています。意図的でない場合は元に戻すことを検討してください。
References
- 既存コメントや設定の意図を尊重し、キー順やフォーマットだけを理由にした不要な churn は避けてください。 (link)
📝 WalkthroughWalkthroughGitHub repository設定を宣言的に管理するための 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
dot_config/zabrze/github.toml (1)
1-14:gh.tomlへの統合検討
gh infraはgh拡張のサブコマンドであり、既存のdot_config/zabrze/gh.toml(gh 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 -->
| - 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 |
There was a problem hiding this comment.
🧩 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:
- 1: https://docs.github.com/en/github/administering-a-repository/enabling-required-reviews-for-pull-requests
- 2: https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets
- 3: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets
- 4: https://stackoverflow.com/questions/74332878/why-cant-i-approve-my-own-pr-in-github-even-when-i-have-disabled-the-setting-f
- 5: https://docs.github.com/articles/approving-a-pull-request-with-required-reviews
- 6: https://docs.github.com/enterprise-cloud%40latest/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets
- 7: https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_ruleset
🏁 Script executed:
cat dot_config/gh-infra/dotfiles.yamlRepository: 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 を追加するか、承認要件を見直してください。
| [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/" |
There was a problem hiding this comment.
🧩 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/miseRepository: 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 fRepository: 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 -20Repository: 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"; doneRepository: 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-112dot_config/mise/config.toml:行 212-222
.chezmoiignore で mise.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.
| [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/" |
| ### /gh-infra-plan | ||
|
|
||
| Run `gh infra plan` to see changes. | ||
|
|
||
| ### /gh-infra-apply | ||
|
|
||
| Run `gh infra apply` to apply changes. |
There was a problem hiding this comment.
コマンド表記の一貫性
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.| ``` | ||
| setup-git-gpg | ||
| ``` | ||
| ``` |
There was a problem hiding this comment.
コードブロックに言語指定を追加(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.
| ``` |
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 162-162: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
| ### 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. |
There was a problem hiding this comment.
節の配置・言語の不整合
このセクションは 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
+ ```
Introduce gh-infra to manage GitHub repository settings and files declaratively.
PR created automatically by Jules for task 15149192065187816130 started by @ryo246912
1. 変更内容概要
GitHub リポジトリ設定を宣言的に管理するツール「gh-infra」を導入しました。以下の内容が追加/更新されています:
dot_config/gh-infra/dotfiles.yaml: dotfiles リポジトリの構成設定(マージポリシー、ルールセットなど)を定義mise.tomlとdot_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.mdとCLAUDE.md: セットアップワークフローの更新(setup-githubコマンドをmise run gh-infra-setupとmise run gh-infra-applyに置き換え)2. 変更理由
GitHub リポジトリ設定を従来のコマンドから宣言的な設定ファイルベースの管理に移行することで、設定の再現性と追跡可能性を向上させます。gh-infra 拡張機能を活用し、リポジトリ設定とファイルの管理を自動化・スケーラブルにすることが狙いです。
3. 確認した項目