-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (70 loc) · 2.43 KB
/
docs.yml
File metadata and controls
86 lines (70 loc) · 2.43 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
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Update API Documentation
on:
schedule:
# Run nightly at 2 AM UTC
- cron: "0 2 * * *"
workflow_dispatch:
jobs:
docs:
name: Update API Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout react-router-api-docs
uses: actions/checkout@v4
with:
path: react-router-api-docs
ref: main
- name: Checkout react-router
uses: actions/checkout@v4
with:
repository: remix-run/react-router
path: react-router
ref: main
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: "pnpm"
cache-dependency-path: react-router/pnpm-lock.yaml
- name: Install dependencies
working-directory: react-router
run: pnpm install --frozen-lockfile
- name: Generate documentation
id: generate
working-directory: react-router
run: |
pnpm run build
pnpm run docs:typedoc
if [ ! -d "public/dev" ]; then
echo "Error: Documentation not generated"
exit 1
fi
echo "react_router_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Copy documentation
run: |
rm -rf react-router-api-docs/v7/*
cp -r react-router/public/dev/* react-router-api-docs/v7/
- name: Commit and push changes
working-directory: react-router-api-docs
run: |
git add v7/
if [ -z "$(git status --porcelain)" ]; then
echo "No changes detected"
exit 0
fi
# Exit if only sitemap.xml changed, which means it was only timestamp updates
if [ "$(git diff --name-only --cached | wc -l)" -eq 1 ]; then
if [ "$(git diff --name-only --cached)" = "v7/sitemap.xml" ]; then
echo "Only sitemap.xml changed (timestamps), skipping commit"
exit 0
fi
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Updated API documentation from react-router SHA ${{ steps.generate.outputs.react_router_sha }}"
git push
echo "Pushed docs changes https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)"