-
Notifications
You must be signed in to change notification settings - Fork 0
feat: introduce gh-infra for declarative repository management #900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| apiVersion: gh-infra/v1 | ||
| kind: Repository | ||
| metadata: | ||
| name: ryo246912/dotfiles | ||
| spec: | ||
| description: "ryo246912's dotfiles" | ||
| visibility: public | ||
| topics: | ||
| - dotfiles | ||
| - chezmoi | ||
| - mise | ||
| - zsh | ||
| homepage_url: https://github.com/ryo246912/dotfiles | ||
| has_issues: true | ||
| has_projects: false | ||
| has_wiki: false | ||
| allow_squash_merge: true | ||
| allow_merge_commit: true | ||
| allow_rebase_merge: false | ||
| delete_branch_on_merge: true | ||
| allow_update_branch: true | ||
| squash_merge_commit_title: PR_TITLE | ||
| squash_merge_commit_message: PR_BODY | ||
| rulesets: | ||
| - name: main | ||
| enforcement: active | ||
| target: branch | ||
| conditions: | ||
| ref_name: | ||
| include: | ||
| - "~DEFAULT_BRANCH" | ||
| exclude: [] | ||
| rules: | ||
| - type: deletion | ||
| - type: non_fast_forward | ||
| - type: required_signatures | ||
| - 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 | ||
|
Comment on lines
+37
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 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.yamlRepository: ryo246912/dotfiles Length of output: 1177
GitHub の仕様上、PR 作者は自身の PR を承認できません。このリポジトリは単独メンテナ構成ですが、 現在の設定に |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -208,3 +208,15 @@ run = "prettier --check '**/*.json'" | |||||||||||||||||||||||
| [tasks.fix-json] | ||||||||||||||||||||||||
| description = "Run fix json files" | ||||||||||||||||||||||||
| run = "prettier --write '**/*.json'" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| [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
+212
to
+222
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+212
to
+222
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 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
同一タスク(
これらのタスクはリポジトリ root の 削除対象-[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
Suggested change
|
||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # gh-infra | ||
|
|
||
| Manage GitHub repository settings and files declaratively using gh-infra. | ||
|
|
||
| ## Commands | ||
|
|
||
| ### /gh-infra-plan | ||
|
|
||
| Run `gh infra plan` to see changes. | ||
|
|
||
| ### /gh-infra-apply | ||
|
|
||
| Run `gh infra apply` to apply changes. | ||
|
Comment on lines
+7
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. コマンド表記の一貫性
提案 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. |
||
|
|
||
| ## Usage | ||
|
|
||
| Use these commands when you want to update GitHub repository settings (topics, visibility, merge strategies) or distribute files across repositories managed by gh-infra. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [[snippets]] | ||
| name = "gh infra plan" | ||
| snippet = "gh infra plan dot_config/gh-infra/" | ||
| trigger = "ghip" | ||
|
|
||
| [[snippets]] | ||
| name = "gh infra apply" | ||
| snippet = "gh infra apply dot_config/gh-infra/" | ||
|
Comment on lines
+3
to
+8
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| trigger = "ghia" | ||
|
|
||
| [[snippets]] | ||
| name = "gh infra import" | ||
| snippet = "gh infra import" | ||
| trigger = "ghii" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
個人リポジトリにおいて
required_approving_review_count: 1を設定すると、自分自身でプルリクエストを承認できないため、マージがブロックされる可能性があります。他に承認できる共同作業者がいない場合は、この値を0に設定することを検討してください。