---
title: Repository settings
description: Settings the pipeline needs that live outside the workflow files, and which of them Terraform manages.
sidebar:
  icon: settings
---

GitHub Environments, their reviewers and variables, and branch rules are repository settings, not files in `.github/`. A workflow that names an Environment that does not exist creates an empty one with **no protection rules**, so these settings must exist before the first run.

## Managed by `infrastructure/github`

- [ ] Environments `dev`, `staging`, `prod` exist, with names that match `github_environment` in each account's bootstrap
- [ ] Each Environment: deployment branches limited to `main` (custom policy, pattern `main`)
- [ ] `prod`: at least one required reviewer (the variable validation refuses an empty list); `prevent_self_review = false`; admins cannot bypass
- [ ] `dev`, `staging`: no reviewers, so that merges deploy automatically
- [ ] Environment variables in each Environment: `AWS_DEPLOY_ROLE_ARN`, `AWS_TERRAFORM_APPLY_ROLE_ARN`, `ECR_REPOSITORY_URL`, `ECS_CLUSTER`, `ECS_SERVICE`, `TASK_FAMILY`, `SITE_BUCKET`, `DISTRIBUTION_ID`, `PUBLIC_URL`, `FREEZE_PARAMETER`
- [ ] Repository variables: `AWS_REGION`, plus `TF_PLAN_ROLE_ARN_*`, `TF_STATE_BUCKET_*` and `TF_STATE_KMS_KEY_ARN_*` for `DEV`, `STAGING` and `PROD`
- [ ] Ruleset on `main`: pull request required, stale approvals dismissed, no force push, no deletion
- [ ] Ruleset on `main`: required check **`ci-ok`** from the GitHub Actions app only, branch up to date before merge

## Set by hand

- [ ] `SLACK_WEBHOOK_URL` as an Environment **secret** (optional): `gh secret set SLACK_WEBHOOK_URL --env <env>`
- [ ] OpenAI key in each account's Secrets Manager secret (`openai_secret_arn`); the smoke test needs it
- [ ] Actions enabled, and "Allow GitHub Actions to create and approve pull requests" left off
- [ ] Workflow permissions default set to read-only; the workflows ask for more per job
- [ ] A plan that supports required reviewers for this repository: public, or GitHub Enterprise when private

## Already in the workflows

- [x] `permissions: {}` at the top of every workflow
- [x] No `pull_request_target`
- [x] `persist-credentials: false` on every checkout
- [x] Actions pinned to commit SHAs, and tool images pinned by digest
- [x] No AWS keys anywhere; OIDC only
