Repository navigation
60 lines (50 loc) · 2 KB
/
Copy pathsync-management-api-docs.yml
File metadata and controls
60 lines (50 loc) · 2 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
name: Sync REST 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 REST 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: "24"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Generate docs and Postman collection
working-directory: apps/docs
run: pnpm run generate:rest-api-docs
- name: Check for changes
id: changes
run: |
if [[ -z "$(git status --porcelain --untracked-files=all -- apps/docs/content/docs/rest-api/ apps/docs/public/prisma-rest-api.postman_collection.json apps/docs/vercel.json)" ]]; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "No changes detected"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "Changes detected:"
git status --short -- apps/docs/content/docs/rest-api/ apps/docs/public/prisma-rest-api.postman_collection.json apps/docs/vercel.json
fi
- 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/rest-api/ apps/docs/public/prisma-rest-api.postman_collection.json apps/docs/vercel.json
git commit -m "chore(docs): sync REST 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
run: curl --fail -X POST "${{ secrets.VERCEL_DEPLOY_HOOK_URL }}"