-
Notifications
You must be signed in to change notification settings - Fork 927
81 lines (66 loc) · 2.45 KB
/
sync-management-api-docs.yml
File metadata and controls
81 lines (66 loc) · 2.45 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
name: Sync Management API Docs
on:
repository_dispatch:
types: [management-api-updated]
workflow_dispatch:
concurrency:
group: sync-management-api-docs
cancel-in-progress: false
jobs:
sync:
name: Sync Management API Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Fetch OpenAPI spec
working-directory: apps/docs
run: pnpm fetch-openapi
- name: Clean stale endpoint files
run: find apps/docs/content/docs/management-api/endpoints -name '*.mdx' -type f -delete
- name: Generate docs
working-directory: apps/docs
run: pnpm tsx scripts/generate-docs.ts
- name: Check for changes
id: changes
run: |
if [[ -z "$(git status --porcelain --untracked-files=all -- apps/docs/content/docs/management-api/)" ]]; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "No MDX changes detected"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "MDX changes detected:"
git status --short -- apps/docs/content/docs/management-api/
fi
- name: Validate links
if: steps.changes.outputs.changed == 'true'
run: pnpm run lint:links
- name: Validate spelling
if: steps.changes.outputs.changed == 'true'
run: pnpm run lint:spellcheck
- name: Build docs
if: steps.changes.outputs.changed == 'true'
working-directory: apps/docs
run: pnpm exec next build
- name: Commit and push
if: steps.changes.outputs.changed == 'true'
run: |
git config user.email "prismabots@gmail.com"
git config user.name "Prismo"
git add apps/docs/content/docs/management-api/
git commit -m "chore(docs): sync management API documentation"
git push "https://x-access-token:${{ secrets.BOT_TOKEN_DOCS_COMMIT }}@github.com/${{ github.repository }}.git" HEAD:${{ github.ref_name }}
- name: Trigger Vercel deploy
if: steps.changes.outputs.changed == 'true'
run: curl --fail -X POST "${{ secrets.VERCEL_DEPLOY_HOOK_URL }}"