Trim GitHub README section to layout and examples
This commit is contained in:
@@ -4,11 +4,22 @@ Manage Gitea resources, teams, repos, and Woodpecker CI via Terraform.
|
||||
|
||||
## GitHub (IUCLabs)
|
||||
|
||||
`config/github.com/IUCLabs/` feeds `modules/github_org` via `environments/github/iuclabs`, authenticated as a GitHub App (`kv/service/github/iuclabs/terraform`). Org membership invites are manual.
|
||||
`config/github.com/IUCLabs/` → `environments/github/iuclabs` → `modules/github_org`. GitHub App credentials and `billing_email` come from `kv/service/github/iuclabs/terraform`. Org membership invites are manual.
|
||||
|
||||
`modules/github_org` validates config, manages org-level settings, and calls `modules/team` (team + memberships), `modules/repository` (repo, default branch, collaborators, CODEOWNERS) and `modules/ruleset` once per effective `<repo>/<ruleset>` pair, after the repositories.
|
||||
`config.yaml` (optional, every field):
|
||||
|
||||
`config.yaml` (optional) manages org settings: profile (`name`, `description`, `blog`, `location`, `email`, `twitter_username`, `company`), `default_repository_permission` (read, or none), `members_can_create_repositories` (false), `public_runners` (false; lets public repos use the Default runner group). Every other org setting is pinned in the module (no Pages, no repo projects, legacy security toggles off), and `GITHUB_TOKEN` is read-only and non-approving. `billing_email` comes from the `billing_email` field of the same Vault path (`TF_VAR_billing_email`). These resources are `prevent_destroy`, so deleting `config.yaml` fails the plan; to stop managing them, add `removed { from = <resource>; lifecycle { destroy = false } }` blocks to `modules/github_org`.
|
||||
```yaml
|
||||
name: IUCLabs
|
||||
description: ""
|
||||
blog: ""
|
||||
location: ""
|
||||
email: ""
|
||||
twitter_username: ""
|
||||
company: ""
|
||||
default_repository_permission: read # read | none
|
||||
members_can_create_repositories: false
|
||||
public_runners: false # public repos may use the Default runner group
|
||||
```
|
||||
|
||||
`team/<name>.yaml`:
|
||||
|
||||
@@ -26,18 +37,18 @@ description: ""
|
||||
private: true
|
||||
default_branch: main
|
||||
maintainers: [] # users or @team: maintain access, seed initial .github/CODEOWNERS
|
||||
codeowners: [] # push access, for adding to CODEOWNERS later
|
||||
codeowners: [] # push access
|
||||
merge_type: squash # squash | merge | rebase
|
||||
delete_branch_on_merge: true
|
||||
rulesets: [] # opt-in rulesets from ruleset/ (public repos only)
|
||||
rulesets: [] # opt-in rulesets from ruleset/; public repos only
|
||||
exclude_rulesets: [] # opt out of non-mandatory all_repos rulesets
|
||||
```
|
||||
|
||||
`ruleset/<name>.yaml` defines every ruleset:
|
||||
`ruleset/<name>.yaml`:
|
||||
|
||||
```yaml
|
||||
all_repos: false # apply to every public repo (private repos are skipped)
|
||||
mandatory: false # cannot be listed in exclude_rulesets
|
||||
all_repos: false # apply to every public repo; private repos get no all_repos rulesets
|
||||
mandatory: false # cannot be excluded
|
||||
target: branch # branch | tag
|
||||
enforcement: active
|
||||
conditions:
|
||||
@@ -48,10 +59,7 @@ rules:
|
||||
creation: false
|
||||
deletion: true
|
||||
non_fast_forward: true
|
||||
required_status_checks: {contexts: [ci/woodpecker], strict: true} # branch only
|
||||
```
|
||||
|
||||
`branch-protection` (PRs on the default branch) and `tag-protection` (`refs/tags/v*` undeletable, immutable) apply to all public repos. `ref-names-branch` and `ref-names-tag` are mandatory: they block refs with a `+` path component, which would act as a wildcard in Vault policy paths templated from the GitHub OIDC `ref` claim.
|
||||
|
||||
Required status checks are a custom ruleset referenced via `rulesets:`, e.g. `rules: {required_status_checks: {contexts: [ci/woodpecker], strict: true}}`.
|
||||
|
||||
Private repositories cannot list `rulesets` on the free plan; plan fails if they do. Unknown names, excluding a mandatory ruleset, or listing a ruleset in both lists also fail.
|
||||
Shipped rulesets: `branch-protection`, `tag-protection` (all public repos), `ref-names-branch`, `ref-names-tag` (mandatory).
|
||||
|
||||
Reference in New Issue
Block a user