Skip to content

Commit 5165917

Browse files
[sync] Create .github/workflows/apply-repo-settings.yaml
1 parent 2b10cb5 commit 5165917

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
- uses: actions/checkout@v6
52+
53+
- name: Apply
54+
id: apply
55+
uses: nsheaps/github-actions/.github/actions/apply-repo-settings@main
56+
with:
57+
app-id: ${{ secrets.AUTOMATION_GITHUB_APP_ID }}
58+
private-key: ${{ secrets.AUTOMATION_GITHUB_APP_PRIVATE_KEY }}
59+
dry-run: ${{ inputs.dry-run || false }}
60+
61+
- name: Show summary
62+
if: always()
63+
run: |
64+
echo "Summary: ${{ steps.apply.outputs.summary }}"

0 commit comments

Comments
 (0)