gh-infraを 試した メモ
GWなので色々ためしてみている。
#gh-infra
babarot/gh-infra: Declarative GitHub infrastructure management via YAML
Terraformではない方法でRepositoryの設定を管理できるみたい。
以前にTerraformのGitHub Providerを試したときは、Copilot Reviewが指定できなくて断念したのでこっちでできるのなら使いたいなという動機である。
GitHubのRepositoryの設定をOpenTofuで管理してみようとした
以下、v0.13.0時点の情報を元に書く。
#既存の設定の読み込み
https://github.com/babarot/gh-infra/tree/v0.13.0#quick-startに書いてある通り。
gh infra import babarot/my-project > my-project.yaml
上記でリポジトリの設定を書き出せる。
centralなリポジトリで管理しないのであれば、.github/gh-infra.yamlとかに置くのがよいのだろうか?
#CIで変更検知
administration: readが必要みたい。
この権限はCIのJob Tokenでは付与できないので、GitHub Appを発行しないとだめそう。
ローカルであれば、多くの場合この権限があるはずなので以下で確認できる。
gh infra plan --ci path/to/config.yaml
差分があると以下のように出力される。
$ gh infra plan --ci .github/gh-infra.yaml
Reading desired state from ~/ghq/github.com/Omochice/ddc-source-cc_command/.github/gh-infra.yaml ...
Fetching current state from GitHub API ...
✓ Omochice/ddc-source-cc_command planned desired changes
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Resource actions are indicated with the following symbols:
~ update
# Omochice/ddc-source-cc_command will be updated
~ Omochice/ddc-source-cc_command
~ actions
~ sha_pinning_required true → false
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Plan: 0 to create, 1 to update, 0 to destroy
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
To apply, run: gh infra apply
#skills
現代のツールらしく、Coding Agent向けのskillsも同梱されている。
https://github.com/babarot/gh-infra/tree/v0.13.0/skills