Repository navigation
feat: init.sh / configure-environments.sh で environment 保護を設定可能に - #206
Merged
Merged
Conversation
This was referenced Dec 2, 2026
h13
force-pushed
the
feat/203-environment-protection
branch
from
December 2, 2026 10:34
1cf3a4b to
1c73892
Compare
h13
force-pushed
the
feat/203-environment-protection
branch
from
December 2, 2026 11:16
1c73892 to
50dbff7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #203
概要
Environment の保護設定(required reviewers / prevent self-review / deployment branch policy)はリポ単位の設定で org ルールセットでは一括適用できず、手設定は漏れやすい。これを Fleet のスクリプトとして提供する。
scripts/configure-environments.sh(新規・template-sync 対象): development / production の保護設定を冪等に適用。既存リポにも単体で実行可能--production-reviewers/--development-reviewers <team-slug|user>[,...]— team slug はorgs/{org}/teams/{slug}、user はusers/{login}で id 解決(team を先に試行)--prevent-self-review— reviewers を設定した environment にprevent_self_review: true--branch-policy— 両 environment の deployment branch policy をmainのみに設定(workflow_run起動の cd.yml は評価 ref が常にmainのため、development もmain。docs: デプロイ ID の運用モード選択ガイド(CI-only / Permissive を対等な一級構成に) #193 必須要件 2 に対応)。既存 policy は冪等にスキップ{}、現行 init.sh と同じ)required_approval_count=1)をベストエフォートで設定。Premium 未満などで失敗したら警告してスキップ。--prevent-self-review/--branch-policyは GitLab 相当がない旨を警告scripts/init.sh: 上記 4 オプションを受け取り configure-environments.sh にパススルー。未指定時は従来どおり(後方互換)Acceptance Criteria との対応
--production-reviewers <team> --prevent-self-reviewで production に reviewers + prevent self-review → PUT body に反映(JSON ビルダーの単体確認済み)--branch-policyで両 environment がmainのみ & 既存 cd.yml の dev/prod デプロイが通る →workflow_runの評価 ref は常にmainのため両環境main許可で両方通る設計.templatesyncignore追加 → whitelist 済み(本 PR の CI で templatesyncignore_check が検証)Test Plan
bash -n/ shellcheck(configure-environments.sh / init.sh)グリーンpnpm run check+pnpm run buildグリーン備考
repos/{repo}/environments/{env}は保護設定を置き換えるため、本スクリプトは冪等(再実行で同じ状態に収束)。部分更新ではない点はスクリプトのヘッダに明記