Repository navigation
73 lines (61 loc) · 2.33 KB
/
Copy pathupdate-docs.yml
File metadata and controls
73 lines (61 loc) · 2.33 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
name: Update Versioned Documentation
on:
repository_dispatch:
types: [docs-update]
permissions:
actions: write
contents: write
pull-requests: write
jobs:
update-docs:
runs-on: ubuntu-latest
env:
VERSION: ${{ github.event.client_payload.version }}
REFERENCE_FILE: "release-source/fern/sdk/reference.md"
REFERENCE_SOURCE_DIR: "release-source/fern/sdk"
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
- name: Checkout released SDK reference
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}
path: release-source
persist-credentials: false
- name: Validate reference.md exists
run: |
set -euo pipefail
if [ ! -f "$REFERENCE_FILE" ]; then
echo "ERROR: Reference file not found: $REFERENCE_FILE"
exit 1
fi
echo "Found reference: $REFERENCE_FILE"
- name: Prepare versioned GitHub Pages documentation
run: python3 generator/scripts/prepare_docs.py --version "$VERSION" --source "$REFERENCE_FILE"
- name: Create PR for docs update
id: create-pr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: ${{ github.event.repository.default_branch }}
add-paths: docs
commit-message: "docs: update docs for ${{ env.VERSION }}"
branch: "docs/update-${{ env.VERSION }}"
title: "docs: update docs for ${{ env.VERSION }}"
body: |
Automated documentation update for release **${{ env.VERSION }}**.
- Refreshed `docs/latest/reference.md` from the newest stable v4-or-later snapshot only (or a no-stable-release notice)
- Added/updated `docs/${{ env.VERSION }}/reference.md`
- Regenerated `docs/index.md` with all versioned docs
labels: |
docs
automated
- name: Validate generated docs PR
if: steps.create-pr.outputs.pull-request-number != ''
env:
GH_TOKEN: ${{ github.token }}
PR_BRANCH: ${{ steps.create-pr.outputs.pull-request-branch }}
run: gh workflow run docs-validation.yml --ref "$PR_BRANCH"