Skip to content
Open
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
59 changes: 59 additions & 0 deletions .github/workflows/docs-dispatch.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
Loading