-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (64 loc) · 2.76 KB
/
Copy pathexport-docs.yml
File metadata and controls
73 lines (64 loc) · 2.76 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Docs export pipeline: renders the configured .svx files into plain markdown
# and opens (or updates) a PR against CoverageTracker/coverage-tracker.
#
# This repo is the origin of truth for shared docs content — the generated
# files downstream (docs/generating-coverage-reports.md, docs/INSTALLATION.md)
# must never be edited directly. See README.md § Docs export pipeline for the
# docs-sync GitHub App setup (DOCS_SYNC_APP_ID / DOCS_SYNC_APP_PRIVATE_KEY).
name: Export docs
on:
push:
branches: [main]
paths:
- "src/lib/docs-content/*.svx"
- "scripts/export-docs.ts"
- ".github/workflows/export-docs.yml"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
export:
runs-on: ubuntu-latest
steps:
# Mint an installation token for the docs-sync GitHub App. A bot token is
# required for commit signing: create-pull-request's sign-commits builds
# commits via the GitHub API, which only signs them (as the app bot) when
# authenticated with a GitHub App token — a PAT leaves them unsigned.
# owner/repositories are mandatory to scope the token to the cross-org target repo.
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.DOCS_SYNC_APP_ID }}
private-key: ${{ secrets.DOCS_SYNC_APP_PRIVATE_KEY }}
owner: CoverageTracker
repositories: coverage-tracker
- name: Checkout coveragetracker.dev
uses: actions/checkout@v4
- name: Checkout coverage-tracker
uses: actions/checkout@v4
with:
repository: CoverageTracker/coverage-tracker
token: ${{ steps.app-token.outputs.token }}
path: target-repo
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Export docs
run: node --experimental-strip-types scripts/export-docs.ts target-repo
# Fixed branch name so repeated runs update the same PR; skips cleanly
# (no commit, no PR) when the export produced no diff.
- name: Open or update sync PR
uses: peter-evans/create-pull-request@v7
with:
path: target-repo
branch: docs-sync
sign-commits: true
token: ${{ steps.app-token.outputs.token }}
commit-message: 'docs: sync generated docs from coveragetracker.dev'
title: 'docs: sync generated docs from coveragetracker.dev'
body: |
Automated docs sync from [coveragetracker.dev](https://github.com/CoverageTracker/coveragetracker.dev) (`${{ github.sha }}`).
The files in this PR are generated from `src/lib/docs-content/*.svx` — do not edit them here; edit the `.svx` sources instead.