-
Notifications
You must be signed in to change notification settings - Fork 0
feat(standards): add scheduled sync workflow from AzureLocal/platform #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 \ | ||||||||||||||||||||||||||
| | 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
|
||||||||||||||||||||||||||
| 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/ |
There was a problem hiding this comment.
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/*.mdxthat were deleted (or renamed) upstream inAzureLocal/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 existingstandards/*.mdxbefore copying, or usersync --deletefor just the.mdxfiles) so upstream deletions are reflected here.