-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (59 loc) · 1.9 KB
/
processor.yml
File metadata and controls
74 lines (59 loc) · 1.9 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
name: Process OpenAPI Files
on:
push:
branches:
- main
- stage
paths:
- 'openapi/**'
workflow_dispatch: # Allows the action to be triggered manually
jobs:
process_openapi_files:
runs-on: ubuntu-latest
steps:
# 1. Generate the token using the GitHub App Secrets
- name: Generate Token
uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
# 2. Checkout the code using the generated App token
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq yq nodejs npm
- name: Install Mintlify Scrape
run: npm install @mintlify/scraping@latest -g
- name: Add servers if required
run: bash ./scripts/add_servers.sh
- name: Run the OpenAPI script
run: |
chmod +x ./scripts/process_docs.sh
./scripts/process_docs.sh
- name: Docs output
run: |
echo "The JSON array output from the script is: $docs_output"
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
if git diff --cached --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "Update docs.json with new OpenAPI data"
# Pull latest and rebase our commit on top
git pull --rebase origin ${GITHUB_REF_NAME}
# Push after successful rebase
git push origin ${GITHUB_REF_NAME}