From c9db378ae5a8fec8df6780f28b2ca01a9f5cb321 Mon Sep 17 00:00:00 2001 From: infinityplusone Date: Fri, 15 May 2026 15:06:57 -0400 Subject: [PATCH] ci: add docs-dispatch workflow Pings makegov/docs (the editorial composer) via repository_dispatch when docs/, README.md, CHANGELOG.md, or crates/*/src/** changes on main. docs.makegov.com rebuilds the Rust SDK pages from this repo's docs/. Requires the DOCS_DISPATCH_TOKEN repo secret with contents:write on makegov/docs. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/docs-dispatch.yml | 59 +++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/docs-dispatch.yml diff --git a/.github/workflows/docs-dispatch.yml b/.github/workflows/docs-dispatch.yml new file mode 100644 index 0000000..202fe5f --- /dev/null +++ b/.github/workflows/docs-dispatch.yml @@ -0,0 +1,59 @@ +name: Docs dispatch + +# Fires on push to main when content that affects the published docs site +# changes (docs/, README, CHANGELOG, or the public source of any workspace +# crate). Notifies makegov/docs via repository_dispatch so the docs site +# rebuilds without waiting for someone to push to the composer. +# +# tango-rust is a `coloc-source` repo: its docs/ folder is the authoritative +# source for the Rust SDK pages on docs.makegov.com. +# +# Required secrets: +# DOCS_DISPATCH_TOKEN — GitHub token with contents:write on makegov/docs. +# +# Required variables (optional): +# DOCS_TARGET_REPO — override the dispatch target (default: makegov/docs). + +on: + push: + branches: + - main + paths: + - "docs/**" + - "README.md" + - "CHANGELOG.md" + - "crates/*/src/**" + workflow_dispatch: + +jobs: + dispatch: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Detect changed paths + id: changes + run: | + set -euo pipefail + base=$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD) + external=$(git diff --name-only "$base" HEAD -- 'docs' 'README.md' 'CHANGELOG.md' 'crates' | paste -sd, -) + { + echo "external=$external" + echo "has_external=$([ -n "$external" ] && echo true || echo false)" + } >> "$GITHUB_OUTPUT" + + - name: Dispatch to docs composer (makegov/docs) + if: steps.changes.outputs.has_external == 'true' + env: + GH_TOKEN: ${{ secrets.DOCS_DISPATCH_TOKEN }} + TARGET: ${{ vars.DOCS_TARGET_REPO || 'makegov/docs' }} + run: | + gh api "repos/$TARGET/dispatches" \ + -f event_type=external_updated \ + -f "client_payload[source_repo]=${{ github.repository }}" \ + -f "client_payload[source_ref]=${{ github.sha }}" \ + -f "client_payload[changed_paths]=${{ steps.changes.outputs.external }}"