redline-sync.yml
Lands the current standards on every registered repository as a pull request, whenever standards/ changes on main. Lives in this (source) repo.
Lands the current standards on every registered repository as a pull request — never a push, never a merge.
| Runs in | This (source) repository. |
|---|---|
| Runs on | A push to main touching standards/**, cli/render/**, templates/** or .github/pull_request_template.md, and workflow_dispatch with dry-run and only <owner/name> inputs. |
| Credential | REDLINE_SYNC_TOKEN: contents, pull_requests and workflows write on every registered repository. It only opens pull requests. |
| Leaves behind | At most one open pull request per registered repository that is behind, updated in place on the next run. |
What a run does
- Runs scripts/render-self.mjs --check first, so stale artifacts are never distributed.
- Builds the CLI and runs node dist/bin/redline.js sync under REDLINE_SYNC_TOKEN, passing --dry-run and --repo <owner/name> when the dispatch inputs set them.
Setting it up
Already here. It needs the REDLINE_SYNC_TOKEN secret, and it only targets repositories listed in registry.json.
Changing it
Edit workflows/redline-sync.yml in this repository, then follow Changing a workflow. It runs from this repository, so the change takes effect when it merges.
Related
- Distribution and drift
- Who runs what — every credential, side by side.
- All workflows
The full file
# Lives in the Redline source repo. Distributes the rendered standards to onboarded
# repos as pull requests — never as direct pushes, and never as a merge.
#
# Targets come from registry.json, the derived register the Redline Registry workflow
# refreshes nightly from the .redline.json each onboarded repo carries. Nothing here is
# hand-maintained: a repository that removes Redline leaves the register, and stops being
# a target, without anyone editing a list.
#
# What a repository does with its sync pull request is the repository's decision. Sync
# makes the change available; the estate dashboard's coverage figure is what makes an
# ignored one visible.
name: Redline Sync
on:
push:
branches: [main]
paths:
- 'standards/**'
- 'cli/render/**'
- 'templates/**'
- '.github/pull_request_template.md'
workflow_dispatch:
inputs:
dry-run:
description: Print the plan without opening pull requests
type: boolean
default: false
only:
description: Sync a single repo, as owner/name
type: string
required: false
permissions:
contents: read
concurrency:
group: redline-sync
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
- name: Install
run: npm ci
# A sync that distributed stale artifacts would propagate the staleness to
# every onboarded repository at once, as a pull request each team is being
# asked to trust. This runs first for that reason.
- name: Verify rendered artifacts in this repo are current
run: node scripts/render-self.mjs --check
- name: Build CLI
run: npm run build
- name: Open sync pull requests
env:
# Fine-grained PAT or GitHub App installation token. Required permissions on
# every target repo: contents:write, pull_requests:write, workflows:write.
# Without `workflows` the push of .github/workflows/redline.yml is rejected.
GH_TOKEN: ${{ secrets.REDLINE_SYNC_TOKEN }}
DRY: ${{ inputs.dry-run && '--dry-run' || '' }}
ONLY: ${{ inputs.only }}
run: |
set -euo pipefail
args=()
[[ -n "$DRY" ]] && args+=("$DRY")
[[ -n "$ONLY" ]] && args+=(--repo "$ONLY")
node dist/bin/redline.js sync ${args[@]+"${args[@]}"}
- name: Summarise
if: always()
run: echo "Sync finished with status ${{ job.status }}" >> "$GITHUB_STEP_SUMMARY"