Sync standards from platform #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 full tag, e.g. main or azurelocal-platform-v0.1.0)" | |
| 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/docs/standards/*.md → site/standards/ (as .mdx) | |
| run: | | |
| set -euo pipefail | |
| mkdir -p standards | |
| # Source moved to docs/standards/ in platform (MkDocs home). | |
| # Copy .md files and rename to .mdx so Docusaurus renders them consistently. | |
| for f in _platform/docs/standards/*.md; do | |
| base=$(basename "$f" .md) | |
| # Skip the how-to pages that live only in platform docs, not in site standards | |
| case "$base" in consuming|contributing|propagation|authoring-guide) continue ;; esac | |
| cp -v "$f" "standards/${base}.mdx" | |
| done | |
| rm -rf _platform | |
| - name: Detect changes | |
| id: diff | |
| run: | | |
| # git diff only sees tracked files; git status --porcelain also catches new/deleted files | |
| changes=$(git status --porcelain -- standards/) | |
| if [ -z "$changes" ]; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| echo "No standards changes — nothing to sync." | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| echo "$changes" | |
| 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 |