-
Notifications
You must be signed in to change notification settings - Fork 22
56 lines (47 loc) · 1.63 KB
/
updated_openapi.yml
File metadata and controls
56 lines (47 loc) · 1.63 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
name: Generate API Docs
on:
pull_request:
paths:
- "website/public/openapi.json"
jobs:
generate-api-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure the full history is available
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18' # Use the version of Node.js your project requires
- name: Install dependencies
working-directory: website
run: npm ci
- name: Generate API docs
working-directory: website
run: |
rm -rf docs/api/HTTP/*
npm run docusaurus gen-api-docs all
- name: Check for new or modified .mdx files
run: |
if git diff --name-only | grep '\.mdx$'; then
echo "CHANGES_FOUND=true" >> $GITHUB_ENV
else
echo "CHANGES_FOUND=false" >> $GITHUB_ENV
fi
- name: Configure Git user
if: env.CHANGES_FOUND == 'true'
run: |
git config --global user.name 'Spice Schema Bot'
git config --global user.email 'schema-bot@spice.ai'
- name: Commit and push changes
if: env.CHANGES_FOUND == 'true'
working-directory: website
run: |
git add docs/api/HTTP/
git commit -m "chore: update API docs" || exit 0 # Prevent failure if no changes
git pull --rebase origin "${{ github.head_ref }}" # Pull latest changes and rebase
git push origin "HEAD:refs/heads/${{ github.head_ref }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}