Skip to content

Commit 401207e

Browse files
ci(docs): add docs-dispatch workflow for makegov/docs auto-pull (makegov/docs#15)
Fires on push to main when docs/, README.md, or CHANGELOG.md changes and dispatches `external_updated` to makegov/docs so the public docs site rebuilds. Required so the auto-pull pipeline picks up SDK doc changes without waiting for someone to push to the docs composer. Requires `DOCS_DISPATCH_TOKEN` secret (contents:write on makegov/docs). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 42d760d commit 401207e

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Docs dispatch
2+
3+
# Fires on push to main when content that affects the published docs site
4+
# changes (docs/, README, or CHANGELOG). Notifies makegov/docs via
5+
# repository_dispatch so the docs site rebuilds without waiting for someone
6+
# to push to the composer.
7+
#
8+
# tango-python is a `coloc-source` repo: its docs/ folder is the authoritative
9+
# source for the Python SDK pages on docs.makegov.com (see makegov/docs#15).
10+
#
11+
# Required secrets:
12+
# DOCS_DISPATCH_TOKEN — GitHub token with contents:write on makegov/docs.
13+
#
14+
# Required variables (optional):
15+
# DOCS_TARGET_REPO — override the dispatch target (default: makegov/docs).
16+
17+
on:
18+
push:
19+
branches:
20+
- main
21+
paths:
22+
- "docs/**"
23+
- "README.md"
24+
- "CHANGELOG.md"
25+
workflow_dispatch:
26+
27+
jobs:
28+
dispatch:
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 2
36+
37+
- name: Detect changed paths
38+
id: changes
39+
run: |
40+
set -euo pipefail
41+
base=$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD)
42+
external=$(git diff --name-only "$base" HEAD -- 'docs' 'README.md' 'CHANGELOG.md' | paste -sd, -)
43+
{
44+
echo "external=$external"
45+
echo "has_external=$([ -n "$external" ] && echo true || echo false)"
46+
} >> "$GITHUB_OUTPUT"
47+
48+
- name: Dispatch to docs composer (makegov/docs)
49+
if: steps.changes.outputs.has_external == 'true'
50+
env:
51+
GH_TOKEN: ${{ secrets.DOCS_DISPATCH_TOKEN }}
52+
TARGET: ${{ vars.DOCS_TARGET_REPO || 'makegov/docs' }}
53+
run: |
54+
gh api "repos/$TARGET/dispatches" \
55+
-f event_type=external_updated \
56+
-f "client_payload[source_repo]=${{ github.repository }}" \
57+
-f "client_payload[source_ref]=${{ github.sha }}" \
58+
-f "client_payload[changed_paths]=${{ steps.changes.outputs.external }}"

0 commit comments

Comments
 (0)