-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (53 loc) · 1.91 KB
/
docs-dispatch.yml
File metadata and controls
58 lines (53 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Docs dispatch
# Fires on push to main when content that affects the published docs site
# changes (docs/, README, or CHANGELOG). Notifies makegov/docs via
# repository_dispatch so the docs site rebuilds without waiting for someone
# to push to the composer.
#
# tango-python is a `coloc-source` repo: its docs/ folder is the authoritative
# source for the Python SDK pages on docs.makegov.com (see makegov/docs#15).
#
# 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"
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' | 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 }}"