Skip to content

Commit ca9bdfe

Browse files
[sync] Create .github/workflows/apply-repo-settings.yaml
1 parent 23d303b commit ca9bdfe

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# This file is managed by nsheaps/.github (sync-files).
2+
# Source: https://github.com/nsheaps/.github/blob/main/ansible/templates/.github/workflows/apply-repo-settings.yaml
3+
# Edit-in-place will be overwritten on the next sync.
4+
name: Apply Repo Settings
5+
6+
# Reads `.github/settings.yml` from THIS repo and applies the
7+
# repository config + rulesets via the apply-repo-settings action
8+
# (https://github.com/nsheaps/github-actions/tree/main/.github/actions/apply-repo-settings).
9+
#
10+
# Ephemeral, in-workflow alternative to the third-party
11+
# repository-settings GitHub App. Runs only when invoked.
12+
#
13+
# Auth: reuses the org's automation App (AUTOMATION_GITHUB_APP_*) —
14+
# same app used by sync-labels / sync-files / sync-secrets / sync-stars.
15+
# That app must have `Administration: write` for rulesets to apply; if
16+
# they don't, check the app's permission grants first.
17+
#
18+
# Triggers:
19+
# workflow_dispatch manual, with dry-run toggle
20+
# repository_dispatch external triggers (other workflows / curl)
21+
# push to main when .github/settings.yml changes
22+
23+
on:
24+
workflow_dispatch:
25+
inputs:
26+
dry-run:
27+
description: "Render only; don't apply"
28+
type: boolean
29+
default: false
30+
repository_dispatch:
31+
types: [apply-repo-settings]
32+
push:
33+
branches: [main]
34+
paths:
35+
- '.github/settings.yml'
36+
- '.github/workflows/apply-repo-settings.yaml'
37+
38+
permissions:
39+
contents: read
40+
41+
concurrency:
42+
# Serialize per-ref so a fast follow-up push waits for the in-flight run.
43+
group: apply-repo-settings-${{ github.ref }}
44+
cancel-in-progress: false
45+
46+
jobs:
47+
apply:
48+
name: Apply settings to this repo
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Checkout as GitHub App
52+
id: checkout
53+
uses: nsheaps/github-actions/.github/actions/checkout-as-app@main
54+
with:
55+
app-id: ${{ secrets.AUTOMATION_GITHUB_APP_ID }}
56+
private-key: ${{ secrets.AUTOMATION_GITHUB_APP_PRIVATE_KEY }}
57+
58+
- name: Apply
59+
id: apply
60+
uses: nsheaps/github-actions/.github/actions/apply-repo-settings@main
61+
with:
62+
token: ${{ steps.checkout.outputs.token }}
63+
dry-run: ${{ inputs.dry-run || false }}
64+
65+
- name: Show summary
66+
if: always()
67+
run: |
68+
echo "Summary: ${{ steps.apply.outputs.summary }}"

0 commit comments

Comments
 (0)