Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/sync-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Sync standards from platform

# Per ADR-0002 in AzureLocal/platform: standards/*.mdx are authored in
# AzureLocal/platform/standards/ and this site renders them. This workflow
# pulls the canonical copies and opens a PR when they diverge.

on:
schedule:
# Weekly — Mondays 06:00 UTC. Platform releases are the authoritative
# trigger; this cron is the safety net in case a release didn't fire
# a repository_dispatch.
- cron: "0 6 * * 1"
workflow_dispatch:
inputs:
platform_ref:
description: "Platform ref to sync from (branch or tag)"
required: false
default: "main"
repository_dispatch:
# Fired by AzureLocal/platform's release workflow on every version tag.
types:
- platform-standards-updated

permissions:
contents: write
pull-requests: write

jobs:
sync:
name: Pull platform/standards into site
runs-on: ubuntu-latest
steps:
- name: Checkout site
uses: actions/checkout@v4

- name: Checkout platform
uses: actions/checkout@v4
with:
repository: AzureLocal/platform
ref: ${{ github.event.inputs.platform_ref || github.event.client_payload.ref || 'main' }}
path: _platform

- name: Copy platform/standards/*.mdx → site/standards/
run: |
set -euo pipefail
mkdir -p standards
# Copy only .mdx (README.md on platform is an index for humans, not a rendered page)
find _platform/standards -maxdepth 1 -name "*.mdx" -print0 \
Comment on lines +47 to +48
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copy step only overwrites/creates files; it never removes standards/*.mdx that were deleted (or renamed) upstream in AzureLocal/platform. That means the sync can report a clean diff while stale local standards pages remain and continue to render. Consider mirroring instead (e.g., delete existing standards/*.mdx before copying, or use rsync --delete for just the .mdx files) so upstream deletions are reflected here.

Suggested change
# Copy only .mdx (README.md on platform is an index for humans, not a rendered page)
find _platform/standards -maxdepth 1 -name "*.mdx" -print0 \
# Mirror only top-level .mdx files (README.md on platform is an index
# for humans, not a rendered page) so upstream deletions/renames are
# reflected locally without touching non-.mdx files.
find standards -maxdepth 1 -name "*.mdx" -type f -delete
find _platform/standards -maxdepth 1 -name "*.mdx" -type f -print0 \

Copilot uses AI. Check for mistakes.
| xargs -0 -I{} cp -v "{}" standards/
rm -rf _platform

- name: Detect changes
id: diff
run: |
if git diff --quiet --exit-code -- standards/; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No standards changes — nothing to sync."
else
echo "changed=true" >> "$GITHUB_OUTPUT"
git diff --stat -- standards/
Comment on lines +55 to +60
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git diff --quiet -- standards/ does not detect untracked files. If AzureLocal/platform adds a new standards/*.mdx, the copy step creates an untracked file here and this step can still report changed=false, so no PR is opened. Use a detector that includes untracked files (e.g., git status --porcelain -- standards/), or stage intent-to-add (git add -N standards/) before diffing.

Suggested change
if git diff --quiet --exit-code -- standards/; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No standards changes — nothing to sync."
else
echo "changed=true" >> "$GITHUB_OUTPUT"
git diff --stat -- standards/
if [ -z "$(git status --porcelain -- standards/)" ]; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No standards changes — nothing to sync."
else
echo "changed=true" >> "$GITHUB_OUTPUT"
git status --short -- standards/

Copilot uses AI. Check for mistakes.
fi

- name: Open sync PR
if: steps.diff.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: chore/sync-standards-from-platform
base: main
title: "chore(standards): sync from AzureLocal/platform"
commit-message: |
chore(standards): sync from AzureLocal/platform

Auto-generated by .github/workflows/sync-standards.yml.
Source: AzureLocal/platform/standards/ @ ${{ github.event.inputs.platform_ref || github.event.client_payload.ref || 'main' }}
body: |
Automated pull of `standards/*.mdx` from
[`AzureLocal/platform`](https://github.com/AzureLocal/platform/tree/main/standards).

Per [ADR-0002](https://github.com/AzureLocal/platform/blob/main/decisions/0002-standards-single-source.md),
standards are authored in the platform repo; this site is the
rendering consumer. This PR is mechanical — review for
breaking rendering changes, not for content edits.

Trigger: `${{ github.event_name }}`
Platform ref: `${{ github.event.inputs.platform_ref || github.event.client_payload.ref || 'main' }}`

**Do not edit `standards/*.mdx` directly on this branch** — the
next sync run will overwrite. Author edits as PRs against
`AzureLocal/platform`.
labels: |
standards
sync
delete-branch: true
Loading