@@ -47,8 +47,9 @@ No edits required. Then set the secrets:
4747| ` CONTRIBUTIONS_SHEET_NAME ` | no | Sheet name within the spreadsheet |
4848| ` GH_UPLOADER_GCP_SA_CREDENTIALS ` | no | GCP service account credentials for Sheets access |
4949
50- Every automation except ` resolve-bot-pr-threads ` authenticates as the bot, so the two required
51- secrets must be set. ` resolve-bot-pr-threads ` uses the default ` GITHUB_TOKEN ` instead.
50+ Every automation except ` resolve-bot-pr-threads ` authenticates as ` learning-equality-bot[bot] ` , the
51+ GitHub App behind ` LE_BOT_APP_ID ` , so the two required secrets must be set. ` resolve-bot-pr-threads `
52+ uses the default ` GITHUB_TOKEN ` instead.
5253
5354Optional means that you accept losing the automations that use the secret. It does not mean that
5455they degrade gracefully. The generated caller forwards every key, so an absent secret reaches the
@@ -68,3 +69,57 @@ leaf workflow as an empty string, and every automation that needs it fails at ru
6869 picks up the wider ` on: ` block the next time they re-copy ` automation-template.yml ` - existing
6970 copies keep running on their current ` on: ` block until then, since GitHub workflow triggers are
7071 evaluated from the file checked into the consumer repo itself, not from this repo.
72+
73+ ## Keeping the copies in sync
74+
75+ Most registry changes reach consumers automatically because their copied file only says:
76+ ` uses: learningequality/.github/.github/workflows/automation.yml@main ` . A consumer needs its file
77+ updated whenever its copy no longer matches the template, which happens in two ways.
78+
79+ The template changes here, such as when a new event or activity type is added to the ` on: ` union,
80+ permissions are widened, or the secret list changes. Or the consumer's own tooling rewrites its
81+ copy, which is reported as a ` toolchain-conflict ` below.
82+
83+ ` .github/workflows/sync-automation-template.yml ` handles this. It runs weekly, on manual dispatch,
84+ and whenever ` automation-template.yml ` changes on ` main ` .
85+
86+ It discovers the consumers by walking the org's repos, skipping archived ones and forks, and keeping
87+ every repo whose ` .github/workflows/automation.yml ` calls this repo's ` automation.yml ` . Each pull
88+ request targets that repo's default branch, which is the only branch GitHub evaluates workflow
89+ triggers from.
90+
91+ For each consumer it compares the copy with the template and opens a pull request when they differ.
92+ A repo that is already in sync gets nothing, while a repo with an existing sync pull request has
93+ that pull request updated rather than a second one opened.
94+
95+ The workflow only proposes changes. It opens pull requests on a branch, never commits to a default
96+ branch, and never merges, approves, or enables auto-merge. A core maintainer in each consumer repo
97+ gives the final review and merges under that repo's own rules.
98+
99+ Run it with ` dry_run ` to see which repos have drifted without opening any pull requests.
100+
101+ Two results turn the run red and require action:
102+
103+ - ` error ` means the repo could not be read or written. The app already has the permissions required
104+ for syncing, so this is usually a transient API failure or the app not being installed on that
105+ repo. Check the installation first for a recently added repo.
106+ - ` toolchain-conflict ` means a sync pull request was merged, the template has not changed since, and
107+ the file has drifted again. The repo's own tooling is rewriting the copy, so the template is not
108+ stable under that toolchain. Fix the template rather than reopening the pull request.
109+
110+ A third result, ` declined ` , keeps the run green and requires no action. It means a core maintainer
111+ closed the last sync pull request without merging it, so the workflow leaves that repo alone until
112+ the template changes again. The repo remains drifted in the meantime. To restore it sooner, copy the
113+ template in by hand.
114+
115+ To onboard a repo, copy the template in and make sure the ` learning-equality-bot[bot] ` app is
116+ installed on it. The next run picks it up. A repo on which the app is not installed stays invisible
117+ to the sync, so the installation is what enrols it.
118+
119+ The pull request body is a short explanation of what changed and why the file is generated.
120+
121+ ` kolibri-design-system ` is the exception. Its ` check-description ` job fails unless the body carries
122+ a Changelog section whose Description is not the placeholder its own template ships with, and a
123+ plain explanation has no such section. For that repo the sync reads its template and fills each
124+ field, so the body is not a half-filled form. Nothing about that template is stored here, so it
125+ stays current as they change it.
0 commit comments