Skip to content

Commit db0db35

Browse files
committed
Add workflow to auto generate docs
1 parent c5b85b6 commit db0db35

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Update API Documentation
2+
3+
on:
4+
schedule:
5+
# Run nightly at 2 AM UTC
6+
- cron: "0 2 * * *"
7+
workflow_dispatch:
8+
9+
jobs:
10+
docs:
11+
name: Update API Documentation
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout react-router-api-docs
15+
uses: actions/checkout@v4
16+
with:
17+
path: react-router-api-docs
18+
ref: main
19+
20+
- name: Checkout react-router
21+
uses: actions/checkout@v4
22+
with:
23+
repository: remix-run/react-router
24+
path: react-router
25+
ref: main
26+
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v4
29+
with:
30+
version: 10
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 24
36+
cache: "pnpm"
37+
cache-dependency-path: react-router/pnpm-lock.yaml
38+
39+
- name: Install dependencies
40+
working-directory: react-router
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Generate documentation
44+
working-directory: react-router
45+
run: |
46+
pnpm run build
47+
pnpm run docs:typedoc
48+
if [ ! -d "public/dev" ]; then
49+
echo "Error: Documentation not generated"
50+
exit 1
51+
fi
52+
53+
- name: Copy documentation
54+
run: |
55+
rm -rf react-router-api-docs/v7/*
56+
cp -r react-router/public/dev/* react-router-api-docs/v7/
57+
58+
- name: Check for documentation changes
59+
id: check_changes
60+
working-directory: react-router-api-docs
61+
run: |
62+
git add v7/
63+
64+
if [ -z "$(git status --porcelain)" ]; then
65+
echo "No changes detected"
66+
exit 0
67+
fi
68+
69+
echo "Changes detected:"
70+
git status
71+
72+
git config user.name "github-actions[bot]"
73+
git config user.email "github-actions[bot]@users.noreply.github.com"
74+
75+
REACT_ROUTER_SHA=$(git -C ../react-router rev-parse --short HEAD)
76+
git commit -m "Update API documentation from SHA ${REACT_ROUTER_SHA}"
77+
# git push

0 commit comments

Comments
 (0)