Skip to content

Commit 55900ea

Browse files
[org-settings] create .github/settings.yml
1 parent 1e12939 commit 55900ea

1 file changed

Lines changed: 375 additions & 0 deletions

File tree

‎.github/settings.yml‎

Lines changed: 375 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,375 @@
1+
# ----------------------------------------------------------------
2+
# Auto-merged from nsheaps/.github on every sync.
3+
# Source: https://github.com/nsheaps/.github/blob/f027f7c849d862078ebdea83099e93ba79f4dd0d/ansible/config/org-settings.yaml
4+
# Edits to this file are KEPT on the next sync (deep merge).
5+
# To remove an org default, delete the key here — it will not come back.
6+
# ----------------------------------------------------------------
7+
# ----------------------------------------------------------------
8+
# Auto-generated from ansible/config/org-settings.yaml. DO NOT EDIT.
9+
# Edit the template, not this file.
10+
# Source: https://github.com/nsheaps/.github/blob/f027f7c849d862078ebdea83099e93ba79f4dd0d/ansible/config/org-settings.yaml
11+
# ----------------------------------------------------------------
12+
# nsheaps org-wide repository defaults — TEMPLATE
13+
#
14+
# This file is the source of truth. It contains ${ENV_VAR} placeholders
15+
# that get substituted by the sync-org-settings workflow (envsubst),
16+
# which writes two rendered outputs back to this repo:
17+
# - .github/org-settings.yaml — rendered (no @default hydration)
18+
# - .github/default-settings.yaml — rendered + @default uncommented
19+
# Edit THIS file for org-wide changes; the rendered outputs are auto-generated.
20+
#
21+
# Sync workflow:
22+
# https://github.com/nsheaps/.github/blob/main/.github/workflows/sync-all.yaml
23+
#
24+
# After rendering, the unified ansible playbook (sync-all) walks every
25+
# managed repo and either:
26+
# - First-touch (no .github/settings.yml in target) → pushes default-settings.yaml
27+
# - Existing target → merges org-settings.yaml in
28+
#
29+
# Merger script + tests:
30+
# https://github.com/nsheaps/.github/blob/main/scripts/org_settings_merge.py
31+
#
32+
# Merge semantics — short version:
33+
# - scalars : target wins (repo's existing value preserved)
34+
# - mappings : recurse
35+
# - rulesets[] : matched by `name`, deep-merged per item
36+
# - rulesets[].rules[] : matched by `type`, deep-merged per item
37+
# - bypass_actors[] : matched by (actor_id, actor_type) — SOURCE wins on scalars
38+
# - enforcement omitted : normalized to `active` at write time
39+
# - NO_BYPASS_RULESETS : for rulesets named here (currently just
40+
# `protect-default-branch`), bypass_actors is
41+
# force-cleared to [] on EVERY sync, even if a
42+
# repo added its own bypass_actors — see
43+
# scripts/org_settings_merge.py. This is the one
44+
# exception to "repos can layer their own
45+
# bypass_actors on top of the org defaults".
46+
#
47+
# Do not set per-repo identity (name/description/homepage/topics) here —
48+
# those belong to each repo.
49+
#
50+
# `# @default` convention: lines tagged `# @default` are uncommented ONLY
51+
# on a repo's FIRST sync (when it has no settings.yml yet). After that the
52+
# commented source line is invisible to deep-merge, so a later change to
53+
# the commented value can't accidentally overwrite the repo's value.
54+
# ----------------------------------------------------------------
55+
56+
# These settings affect the repository itself.
57+
# See https://docs.github.com/en/rest/repos/repos#update-a-repository
58+
repository:
59+
# NOTE: We deliberately do NOT set `name`, `description`, `homepage`,
60+
# or `topics` from the org defaults — those belong to each repo.
61+
# Edit them directly in your repo's .github/settings.yml.
62+
#
63+
# The booleans below are commented with `# @default` — they're set on
64+
# this repo's FIRST sync only. After that, your value wins; org changes
65+
# to the commented line are invisible to subsequent merges.
66+
67+
# A short description of the repository that will show up on GitHub
68+
# description: ...
69+
70+
# A URL with more information about the repository
71+
# homepage: https://example.github.io/
72+
73+
# A comma-separated list of topics to set on the repository
74+
# topics: ...
75+
76+
# Either `true` to make the repository private, or `false` to make it public.
77+
# NOTE: intentionally not set org-wide — public/private is a per-repo decision.
78+
# private: false
79+
80+
# Either `true` to enable issues for this repository, `false` to disable them.
81+
has_issues: true
82+
83+
# Either `true` to enable projects for this repository, or `false` to disable them.
84+
# NOTE: We use org-level projects, not repo-level.
85+
has_projects: false
86+
87+
# Either `true` to enable the wiki for this repository, `false` to disable it.
88+
has_wiki: false
89+
90+
# Either `true` to enable downloads for this repository, `false` to disable them.
91+
has_downloads: false
92+
93+
# Updates the default branch for this repository.
94+
default_branch: main
95+
96+
# Either `true` to allow squash-merging pull requests, or `false` to prevent
97+
# squash-merging.
98+
allow_squash_merge: true
99+
100+
# Either `true` to allow merging pull requests with a merge commit, or `false`
101+
# to prevent merging pull requests with merge commits.
102+
# NOTE: all three merge methods are allowed at the REPOSITORY level. The
103+
# default branch is separately restricted to squash+rebase by the
104+
# `allowed_merge_methods` parameter on the `require-pr` ruleset below, so
105+
# merge commits remain available for non-default-branch merges.
106+
allow_merge_commit: true
107+
108+
# Either `true` to allow rebase-merging pull requests, or `false` to prevent
109+
# rebase-merging.
110+
allow_rebase_merge: true
111+
112+
# Either `true` to enable automatic deletion of branches on merge, or `false`
113+
# to disable.
114+
delete_branch_on_merge: true
115+
116+
# Either `true` to allow auto-merge on pull requests, or `false` to disallow.
117+
allow_auto_merge: true
118+
119+
# Either `true` to always show the "Update branch" button on pull requests
120+
# whose branch is behind the base branch, or `false` to only show it when
121+
# the branch is required to be up to date.
122+
# NOTE: unlike the seeds above it, this one does NOT match GitHub's factory
123+
# default — the REST API creates repos with `allow_update_branch: false`.
124+
# `# @default` here means "the org's seeded value on first touch" (per the
125+
# convention in the header), i.e. a standing org preference, not a restatement
126+
# of GitHub's own default.
127+
allow_update_branch: true
128+
129+
# The default value for a squash merge commit title:
130+
# - PR_TITLE — default to the pull request's title
131+
# - COMMIT_OR_PR_TITLE — default to the commit's title (if only one commit)
132+
# or the pull request's title (when more than one commit)
133+
squash_merge_commit_title: PR_TITLE
134+
135+
# The default value for a squash merge commit message:
136+
# - PR_BODY — default to the pull request's body
137+
# - COMMIT_MESSAGES — default to the branch's commit messages
138+
# - BLANK — default to a blank commit message
139+
squash_merge_commit_message: PR_BODY
140+
141+
# Labels: managed centrally via .github/org-labels.yaml and synced to all
142+
# managed repos by the sync-org-settings workflow's sync-labels job.
143+
# Intentionally omitted from settings.yml so the two sources don't fight.
144+
145+
# Rulesets — repository-level branch/tag rulesets.
146+
# Docs: https://github.com/repository-settings/app/blob/master/docs/plugins/rulesets.md
147+
# API : https://docs.github.com/en/rest/repos/rules
148+
#
149+
# enforcement values:
150+
# - active : rules are enforced
151+
# - disabled : ruleset exists but is not enforced (dormant)
152+
# - evaluate : rules are checked and reported but not enforced (preview)
153+
# NOTE: If `enforcement` is omitted on a ruleset, the sync writer fills it
154+
# with `active`. Each ruleset below either:
155+
# - sets `enforcement: active` (always-on org policy — overriding is discouraged), or
156+
# - sets `enforcement: disabled` plus a commented `# enforcement: 'active'`
157+
# sibling that a repo can uncomment (and delete the disabled line) to enable, or
158+
# - omits `enforcement` and provides a commented `# enforcement: 'active'`
159+
# hint that a repo can uncomment to lock the ruleset on explicitly.
160+
#
161+
# bypass_actors[].bypass_mode values:
162+
# - always : prompts the user to bypass at push/merge time (GitHub UI default)
163+
# - pull_request : bypass only allowed via a PR (push-time bypass blocked)
164+
# NOTE: omitting bypass_mode lets the merger fill `always`.
165+
#
166+
# Every ruleset seeds repo admins (RepositoryRole id 5) as bypass actors so
167+
# the org doesn't lock admins out. Repos can append more bypass_actors; for
168+
# the admin entry itself, source-wins (you can't silently widen admin bypass
169+
# to `always` if the org set `pull_request`).
170+
rulesets:
171+
# ---- 1. No delete / no force-push on the default branch ----
172+
# SECURITY: this ruleset must have NO bypass_actors. Nobody — not repo
173+
# admins, not the automation app, not Renovate — may bypass deletion or
174+
# force-push protection on the default branch. Unlike the other rulesets
175+
# below, this one is in NO_BYPASS_RULESETS (scripts/org_settings_merge.py),
176+
# so the merger force-clears bypass_actors to [] on every sync even if a
177+
# repo has manually added its own bypass_actors here.
178+
#
179+
# If a bypass is ever genuinely needed (e.g. an incident requires a
180+
# force-push or branch deletion to recover the default branch), do NOT
181+
# add a bypass_actor to config. Instead: a repo admin manually grants a
182+
# temporary bypass on the ruleset in the GitHub UI, completes the task,
183+
# then immediately removes the bypass. Never leave a standing bypass in
184+
# place — the next sync will strip it anyway.
185+
- name: protect-default-branch
186+
target: branch
187+
enforcement: active # always enforced — overriding this is discouraged
188+
conditions:
189+
ref_name:
190+
include:
191+
- "~DEFAULT_BRANCH" # special selector: whatever the default branch is
192+
exclude: []
193+
# Intentionally empty — see the SECURITY note above. Do not add actors.
194+
bypass_actors: []
195+
rules:
196+
- type: deletion # block branch deletion
197+
- type: non_fast_forward # block force-push
198+
199+
# ---- 2. PR required (0 reviews) ----
200+
- name: require-pr
201+
target: branch
202+
enforcement: 'active' # uncomment to lock this ruleset on in this repo
203+
conditions:
204+
ref_name:
205+
include: ["~DEFAULT_BRANCH"]
206+
exclude: []
207+
bypass_actors:
208+
# Repo admins can bypass (always = prompts at push/merge time, not silent exempt).
209+
# Repos can add more actors (other teams, integrations).
210+
- actor_id: 5
211+
actor_type: RepositoryRole # 1=read 2=triage 3=write 4=maintain 5=admin
212+
bypass_mode: always
213+
# automation-nsheaps GitHub App — actor_id is substituted from 2549081
214+
215+
# by sync-org-settings when this template is rendered to org-settings.yaml.
216+
- actor_id: 2549081
217+
218+
actor_type: Integration
219+
bypass_mode: exempt
220+
# Mend Renovate cloud GitHub App (renovate[bot], app id 2740) — same
221+
# trusted-automation bypass as automation-nsheaps above, so Renovate's
222+
# *branch* automerge can push dependency updates straight to the default
223+
# branch without a human review/PR. App id is a public constant, hardcoded
224+
# like the github-actions[bot] integration_id below (not a secret, so no
225+
# envsubst placeholder). Renovate is deliberately NOT a bypass actor on
226+
# the required-status-checks ruleset, so green checks remain mandatory.
227+
- actor_id: 2740
228+
actor_type: Integration
229+
bypass_mode: exempt
230+
rules:
231+
- type: pull_request
232+
# The 5 params below are REQUIRED by the API for type=pull_request.
233+
# All defaults here are permissive (0 reviewers, no other gates) so
234+
# the rule only gates "must use a PR" — repos override to add stricter
235+
# checks.
236+
parameters:
237+
required_approving_review_count: 0
238+
dismiss_stale_reviews_on_push: false
239+
require_code_owner_review: false
240+
require_last_push_approval: false
241+
required_review_thread_resolution: false
242+
# Org policy: merges INTO the default branch must be squash or
243+
# rebase — no merge commits on the trunk. This is deliberately set
244+
# (not commented / not `# @default`) so it applies to every managed
245+
# repo on every sync, not just newly-onboarded ones. The repository
246+
# itself still allows all three methods (`allow_merge_commit: true`
247+
# above) so merge commits remain usable for non-default-branch
248+
# merges. If GitHub is not sent this parameter it backfills all
249+
# three methods, which is why omitting it is not equivalent.
250+
allowed_merge_methods: ["squash", "rebase"]
251+
252+
# ---- 3. Review required — 1 reviewer (active by default) ----
253+
- name: require-1-review
254+
target: branch
255+
enforcement: disabled
256+
# enforcement: 'active'
257+
conditions:
258+
ref_name:
259+
include: ["~DEFAULT_BRANCH"]
260+
exclude: []
261+
bypass_actors:
262+
# Repo admins can bypass (always = prompts at push/merge time, not silent exempt).
263+
# Repos can add more actors (other teams, integrations).
264+
- actor_id: 5
265+
actor_type: RepositoryRole # 1=read 2=triage 3=write 4=maintain 5=admin
266+
bypass_mode: always
267+
# automation-nsheaps GitHub App — actor_id is substituted from 2549081
268+
269+
# by sync-org-settings when this template is rendered to org-settings.yaml.
270+
- actor_id: 2549081
271+
272+
actor_type: Integration
273+
bypass_mode: exempt
274+
# Mend Renovate cloud GitHub App (renovate[bot], app id 2740) — see the
275+
# require-pr ruleset above for rationale. Present here so Renovate stays
276+
# exempt from the review requirement if a repo enables this ruleset.
277+
- actor_id: 2740
278+
actor_type: Integration
279+
bypass_mode: exempt
280+
rules:
281+
- type: pull_request
282+
parameters:
283+
required_approving_review_count: 1
284+
# The remaining 4 fields are required by the API for type=pull_request
285+
# whenever ANY parameters are provided. Sensible safe defaults below;
286+
# repos override per-repo.
287+
dismiss_stale_reviews_on_push: true
288+
require_code_owner_review: false
289+
require_last_push_approval: false
290+
required_review_thread_resolution: true
291+
292+
# ---- 4. Checks required ----
293+
# NOTE: shipped ACTIVE. The required_status_checks list seeds an org-wide
294+
# lint check (GitHub Actions App, context "lint") so every managed repo
295+
# gates merges on a workflow named `lint`. Repos that don't yet have one
296+
# should add `.github/workflows/lint.yaml` (or have it synced in via
297+
# sync-files); per-repo additional checks go in this same list.
298+
# GitHub App IDs in `integration_id`:
299+
# 15368 = github-actions[bot] (workflows running on GitHub Actions)
300+
# This is commented because not every repo has a lint workflow but they should
301+
# When this is copied, so is the comment, and they can then uncomment as needed.
302+
# In the long term, we should try to keep build/test/format/lint consistent between all repos
303+
# - name: require-checks
304+
# target: branch
305+
# enforcement: active
306+
# conditions:
307+
# ref_name:
308+
# include: ["~DEFAULT_BRANCH"]
309+
# exclude: []
310+
# bypass_actors:
311+
# # Repo admins can bypass (always = prompts at push/merge time, not silent exempt).
312+
# # Repos can add more actors (other teams, integrations).
313+
# - actor_id: 5
314+
# actor_type: RepositoryRole # 1=read 2=triage 3=write 4=maintain 5=admin
315+
# bypass_mode: always
316+
# # automation-nsheaps GitHub App — actor_id is substituted from 2549081
317+
318+
# # by sync-org-settings when this template is rendered to org-settings.yaml.
319+
# - actor_id: 2549081
320+
321+
# actor_type: Integration
322+
# bypass_mode: always
323+
# rules:
324+
# - type: required_status_checks
325+
# parameters:
326+
# strict_required_status_checks_policy: false
327+
# required_status_checks:
328+
# # Org-wide: a workflow named `lint` must pass. Repos that don't
329+
# # have one yet should add .github/workflows/lint.yaml (or sync the
330+
# # canonical one in). Repos add more entries below for their own CI.
331+
# - context: lint
332+
# integration_id: 15368 # github-actions[bot]
333+
334+
# ---- 5. Review required — 1 reviewer from CODEOWNERS (disabled by default) ----
335+
# NOTE: shipped DISABLED. Repos with a meaningful CODEOWNERS file flip to
336+
# `enforcement: active` and likely set `require-1-review.enforcement: disabled`
337+
# so the two don't double up.
338+
- name: require-codeowner-review
339+
target: branch
340+
enforcement: disabled
341+
# enforcement: 'active' # uncomment (and remove the disabled line above) to enable
342+
conditions:
343+
ref_name:
344+
include: ["~DEFAULT_BRANCH"]
345+
exclude: []
346+
bypass_actors:
347+
# Repo admins can bypass (always = prompts at push/merge time, not silent exempt).
348+
# Repos can add more actors (other teams, integrations).
349+
- actor_id: 5
350+
actor_type: RepositoryRole # 1=read 2=triage 3=write 4=maintain 5=admin
351+
bypass_mode: always
352+
# automation-nsheaps GitHub App — actor_id is substituted from 2549081
353+
354+
# by sync-org-settings when this template is rendered to org-settings.yaml.
355+
- actor_id: 2549081
356+
357+
actor_type: Integration
358+
bypass_mode: exempt
359+
# Mend Renovate cloud GitHub App (renovate[bot], app id 2740) — see the
360+
# require-pr ruleset above for rationale. Present here so Renovate stays
361+
# exempt from the codeowner-review requirement if a repo enables this
362+
# ruleset.
363+
- actor_id: 2740
364+
actor_type: Integration
365+
bypass_mode: exempt
366+
rules:
367+
- type: pull_request
368+
parameters:
369+
required_approving_review_count: 1
370+
require_code_owner_review: true
371+
dismiss_stale_reviews_on_push: true
372+
# Required by the API for type=pull_request whenever any
373+
# parameters are provided. Sensible default; repos override.
374+
require_last_push_approval: false
375+
required_review_thread_resolution: true

0 commit comments

Comments
 (0)