Skip to content

Commit f7caf0f

Browse files
[org-settings] create .github/settings.yml
1 parent c1794f6 commit f7caf0f

1 file changed

Lines changed: 353 additions & 0 deletions

File tree

‎.github/settings.yml‎

Lines changed: 353 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,353 @@
1+
# ----------------------------------------------------------------
2+
# Auto-merged from nsheaps/.github on every sync.
3+
# Source: https://github.com/nsheaps/.github/blob/2a13aac5cd56fbbad1be551ae913e0cb2067c316/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/2a13aac5cd56fbbad1be551ae913e0cb2067c316/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+
allow_merge_commit: false
103+
104+
# Either `true` to allow rebase-merging pull requests, or `false` to prevent
105+
# rebase-merging.
106+
allow_rebase_merge: true
107+
108+
# Either `true` to enable automatic deletion of branches on merge, or `false`
109+
# to disable.
110+
delete_branch_on_merge: true
111+
112+
# Either `true` to allow auto-merge on pull requests, or `false` to disallow.
113+
allow_auto_merge: true
114+
115+
# The default value for a squash merge commit title:
116+
# - PR_TITLE — default to the pull request's title
117+
# - COMMIT_OR_PR_TITLE — default to the commit's title (if only one commit)
118+
# or the pull request's title (when more than one commit)
119+
squash_merge_commit_title: PR_TITLE
120+
121+
# The default value for a squash merge commit message:
122+
# - PR_BODY — default to the pull request's body
123+
# - COMMIT_MESSAGES — default to the branch's commit messages
124+
# - BLANK — default to a blank commit message
125+
squash_merge_commit_message: PR_BODY
126+
127+
# Labels: managed centrally via .github/org-labels.yaml and synced to all
128+
# managed repos by the sync-org-settings workflow's sync-labels job.
129+
# Intentionally omitted from settings.yml so the two sources don't fight.
130+
131+
# Rulesets — repository-level branch/tag rulesets.
132+
# Docs: https://github.com/repository-settings/app/blob/master/docs/plugins/rulesets.md
133+
# API : https://docs.github.com/en/rest/repos/rules
134+
#
135+
# enforcement values:
136+
# - active : rules are enforced
137+
# - disabled : ruleset exists but is not enforced (dormant)
138+
# - evaluate : rules are checked and reported but not enforced (preview)
139+
# NOTE: If `enforcement` is omitted on a ruleset, the sync writer fills it
140+
# with `active`. Each ruleset below either:
141+
# - sets `enforcement: active` (always-on org policy — overriding is discouraged), or
142+
# - sets `enforcement: disabled` plus a commented `# enforcement: 'active'`
143+
# sibling that a repo can uncomment (and delete the disabled line) to enable, or
144+
# - omits `enforcement` and provides a commented `# enforcement: 'active'`
145+
# hint that a repo can uncomment to lock the ruleset on explicitly.
146+
#
147+
# bypass_actors[].bypass_mode values:
148+
# - always : prompts the user to bypass at push/merge time (GitHub UI default)
149+
# - pull_request : bypass only allowed via a PR (push-time bypass blocked)
150+
# NOTE: omitting bypass_mode lets the merger fill `always`.
151+
#
152+
# Every ruleset seeds repo admins (RepositoryRole id 5) as bypass actors so
153+
# the org doesn't lock admins out. Repos can append more bypass_actors; for
154+
# the admin entry itself, source-wins (you can't silently widen admin bypass
155+
# to `always` if the org set `pull_request`).
156+
rulesets:
157+
# ---- 1. No delete / no force-push on the default branch ----
158+
# SECURITY: this ruleset must have NO bypass_actors. Nobody — not repo
159+
# admins, not the automation app, not Renovate — may bypass deletion or
160+
# force-push protection on the default branch. Unlike the other rulesets
161+
# below, this one is in NO_BYPASS_RULESETS (scripts/org_settings_merge.py),
162+
# so the merger force-clears bypass_actors to [] on every sync even if a
163+
# repo has manually added its own bypass_actors here.
164+
#
165+
# If a bypass is ever genuinely needed (e.g. an incident requires a
166+
# force-push or branch deletion to recover the default branch), do NOT
167+
# add a bypass_actor to config. Instead: a repo admin manually grants a
168+
# temporary bypass on the ruleset in the GitHub UI, completes the task,
169+
# then immediately removes the bypass. Never leave a standing bypass in
170+
# place — the next sync will strip it anyway.
171+
- name: protect-default-branch
172+
target: branch
173+
enforcement: active # always enforced — overriding this is discouraged
174+
conditions:
175+
ref_name:
176+
include:
177+
- "~DEFAULT_BRANCH" # special selector: whatever the default branch is
178+
exclude: []
179+
# Intentionally empty — see the SECURITY note above. Do not add actors.
180+
bypass_actors: []
181+
rules:
182+
- type: deletion # block branch deletion
183+
- type: non_fast_forward # block force-push
184+
185+
# ---- 2. PR required (0 reviews) ----
186+
- name: require-pr
187+
target: branch
188+
enforcement: 'active' # uncomment to lock this ruleset on in this repo
189+
conditions:
190+
ref_name:
191+
include: ["~DEFAULT_BRANCH"]
192+
exclude: []
193+
bypass_actors:
194+
# Repo admins can bypass (always = prompts at push/merge time, not silent exempt).
195+
# Repos can add more actors (other teams, integrations).
196+
- actor_id: 5
197+
actor_type: RepositoryRole # 1=read 2=triage 3=write 4=maintain 5=admin
198+
bypass_mode: always
199+
# automation-nsheaps GitHub App — actor_id is substituted from 2549081
200+
201+
# by sync-org-settings when this template is rendered to org-settings.yaml.
202+
- actor_id: 2549081
203+
204+
actor_type: Integration
205+
bypass_mode: exempt
206+
# Mend Renovate cloud GitHub App (renovate[bot], app id 2740) — same
207+
# trusted-automation bypass as automation-nsheaps above, so Renovate's
208+
# *branch* automerge can push dependency updates straight to the default
209+
# branch without a human review/PR. App id is a public constant, hardcoded
210+
# like the github-actions[bot] integration_id below (not a secret, so no
211+
# envsubst placeholder). Renovate is deliberately NOT a bypass actor on
212+
# the required-status-checks ruleset, so green checks remain mandatory.
213+
- actor_id: 2740
214+
actor_type: Integration
215+
bypass_mode: exempt
216+
rules:
217+
- type: pull_request
218+
# The 5 params below are REQUIRED by the API for type=pull_request.
219+
# All defaults here are permissive (0 reviewers, no other gates) so
220+
# the rule only gates "must use a PR" — repos override to add stricter
221+
# checks. allowed_merge_methods is optional; left to repo preference.
222+
parameters:
223+
required_approving_review_count: 0
224+
dismiss_stale_reviews_on_push: false
225+
require_code_owner_review: false
226+
require_last_push_approval: false
227+
required_review_thread_resolution: false
228+
# allowed_merge_methods: [merge, squash, rebase] # optional
229+
230+
# ---- 3. Review required — 1 reviewer (active by default) ----
231+
- name: require-1-review
232+
target: branch
233+
enforcement: disabled
234+
# enforcement: 'active'
235+
conditions:
236+
ref_name:
237+
include: ["~DEFAULT_BRANCH"]
238+
exclude: []
239+
bypass_actors:
240+
# Repo admins can bypass (always = prompts at push/merge time, not silent exempt).
241+
# Repos can add more actors (other teams, integrations).
242+
- actor_id: 5
243+
actor_type: RepositoryRole # 1=read 2=triage 3=write 4=maintain 5=admin
244+
bypass_mode: always
245+
# automation-nsheaps GitHub App — actor_id is substituted from 2549081
246+
247+
# by sync-org-settings when this template is rendered to org-settings.yaml.
248+
- actor_id: 2549081
249+
250+
actor_type: Integration
251+
bypass_mode: exempt
252+
# Mend Renovate cloud GitHub App (renovate[bot], app id 2740) — see the
253+
# require-pr ruleset above for rationale. Present here so Renovate stays
254+
# exempt from the review requirement if a repo enables this ruleset.
255+
- actor_id: 2740
256+
actor_type: Integration
257+
bypass_mode: exempt
258+
rules:
259+
- type: pull_request
260+
parameters:
261+
required_approving_review_count: 1
262+
# The remaining 4 fields are required by the API for type=pull_request
263+
# whenever ANY parameters are provided. Sensible safe defaults below;
264+
# repos override per-repo.
265+
dismiss_stale_reviews_on_push: true
266+
require_code_owner_review: false
267+
require_last_push_approval: false
268+
required_review_thread_resolution: true
269+
270+
# ---- 4. Checks required ----
271+
# NOTE: shipped ACTIVE. The required_status_checks list seeds an org-wide
272+
# lint check (GitHub Actions App, context "lint") so every managed repo
273+
# gates merges on a workflow named `lint`. Repos that don't yet have one
274+
# should add `.github/workflows/lint.yaml` (or have it synced in via
275+
# sync-files); per-repo additional checks go in this same list.
276+
# GitHub App IDs in `integration_id`:
277+
# 15368 = github-actions[bot] (workflows running on GitHub Actions)
278+
# This is commented because not every repo has a lint workflow but they should
279+
# When this is copied, so is the comment, and they can then uncomment as needed.
280+
# In the long term, we should try to keep build/test/format/lint consistent between all repos
281+
# - name: require-checks
282+
# target: branch
283+
# enforcement: active
284+
# conditions:
285+
# ref_name:
286+
# include: ["~DEFAULT_BRANCH"]
287+
# exclude: []
288+
# bypass_actors:
289+
# # Repo admins can bypass (always = prompts at push/merge time, not silent exempt).
290+
# # Repos can add more actors (other teams, integrations).
291+
# - actor_id: 5
292+
# actor_type: RepositoryRole # 1=read 2=triage 3=write 4=maintain 5=admin
293+
# bypass_mode: always
294+
# # automation-nsheaps GitHub App — actor_id is substituted from 2549081
295+
296+
# # by sync-org-settings when this template is rendered to org-settings.yaml.
297+
# - actor_id: 2549081
298+
299+
# actor_type: Integration
300+
# bypass_mode: always
301+
# rules:
302+
# - type: required_status_checks
303+
# parameters:
304+
# strict_required_status_checks_policy: false
305+
# required_status_checks:
306+
# # Org-wide: a workflow named `lint` must pass. Repos that don't
307+
# # have one yet should add .github/workflows/lint.yaml (or sync the
308+
# # canonical one in). Repos add more entries below for their own CI.
309+
# - context: lint
310+
# integration_id: 15368 # github-actions[bot]
311+
312+
# ---- 5. Review required — 1 reviewer from CODEOWNERS (disabled by default) ----
313+
# NOTE: shipped DISABLED. Repos with a meaningful CODEOWNERS file flip to
314+
# `enforcement: active` and likely set `require-1-review.enforcement: disabled`
315+
# so the two don't double up.
316+
- name: require-codeowner-review
317+
target: branch
318+
enforcement: disabled
319+
# enforcement: 'active' # uncomment (and remove the disabled line above) to enable
320+
conditions:
321+
ref_name:
322+
include: ["~DEFAULT_BRANCH"]
323+
exclude: []
324+
bypass_actors:
325+
# Repo admins can bypass (always = prompts at push/merge time, not silent exempt).
326+
# Repos can add more actors (other teams, integrations).
327+
- actor_id: 5
328+
actor_type: RepositoryRole # 1=read 2=triage 3=write 4=maintain 5=admin
329+
bypass_mode: always
330+
# automation-nsheaps GitHub App — actor_id is substituted from 2549081
331+
332+
# by sync-org-settings when this template is rendered to org-settings.yaml.
333+
- actor_id: 2549081
334+
335+
actor_type: Integration
336+
bypass_mode: exempt
337+
# Mend Renovate cloud GitHub App (renovate[bot], app id 2740) — see the
338+
# require-pr ruleset above for rationale. Present here so Renovate stays
339+
# exempt from the codeowner-review requirement if a repo enables this
340+
# ruleset.
341+
- actor_id: 2740
342+
actor_type: Integration
343+
bypass_mode: exempt
344+
rules:
345+
- type: pull_request
346+
parameters:
347+
required_approving_review_count: 1
348+
require_code_owner_review: true
349+
dismiss_stale_reviews_on_push: true
350+
# Required by the API for type=pull_request whenever any
351+
# parameters are provided. Sensible default; repos override.
352+
require_last_push_approval: false
353+
required_review_thread_resolution: true

0 commit comments

Comments
 (0)