Skip to content

Commit c58ea7f

Browse files
Update update-api-docs.yml
1 parent 9bb43c6 commit c58ea7f

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

.github/workflows/update-api-docs.yml

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,70 @@
11
name: Automated OpenAPI Spec Update
22

3-
# Test update
4-
53
on:
6-
# 1. Manually trigger the workflow from the GitHub UI
4+
# Allows manual triggering and selection of branch from the Actions tab
75
workflow_dispatch:
8-
# 2. Trigger the workflow on a schedule (e.g., every day at midnight UTC)
6+
7+
# *** ADDED: This trigger ensures the workflow appears and runs when you push to ANY branch ***
8+
push:
9+
branches:
10+
- '*'
11+
12+
# Runs the workflow on a daily schedule
913
schedule:
1014
- cron: '0 0 * * *'
11-
# 3. Optional: Trigger on push to a specific branch (e.g., 'main')
12-
# push:
13-
# branches:
14-
# - main
1515

1616
jobs:
1717
generate_and_scrape:
18-
# Use a standard Linux runner
1918
runs-on: ubuntu-latest
2019

21-
# Grant the default GITHUB_TOKEN permissions to write back to the repo
20+
# Permissions are required for the auto-commit action to push changes back
2221
permissions:
2322
contents: write
2423

2524
steps:
2625
- name: ⬇️ Checkout docs-v2 (This) Repository
27-
# This checks out the repository where the workflow file lives
2826
uses: actions/checkout@v4
2927
with:
3028
path: docs-v2
31-
# Fetch a deeper history, required for the auto-commit action
3229
fetch-depth: 0
3330

3431
- name: ⬇️ Checkout api2 Source Repository
35-
# Check out the external API repo into a separate directory
3632
uses: actions/checkout@v4
3733
with:
38-
repository: atko-cic/api2 # <<< UPDATE THIS TO YOUR API REPO PATH
34+
repository: atko-cic/api2 # <<< VERIFY THIS REPO PATH
3935
path: api2
4036

41-
- name: 🛠️ Setup Node.js (for both repos)
37+
- name: 🛠️ Setup Node.js
4238
uses: actions/setup-node@v4
4339
with:
4440
node-version: '20'
4541

4642
- name: 📦 Install dependencies in api2
47-
# Installs dependencies needed to run the spec generation script
4843
run: |
4944
cd api2
5045
npm ci
5146
5247
- name: ⚙️ Generate OAPI Spec
53-
# Runs the command to generate the JSON spec file (e.g., api2.json)
5448
run: |
5549
cd api2
5650
npm run spec:generate -w packages/main-api
57-
# Assuming the generated file is named 'api2.json' in the api2 root after the run
5851
5952
- name: 📝 Copy and Modify OpenAPI Spec for Mintlify
60-
# This block handles file transfer and the necessary tokenUrl replacement
6153
run: |
6254
# 1. Copy the generated file to the docs location
6355
cp api2/api2.json docs-v2/main/docs/api2-3.1-internal.json
6456
65-
# 2. Perform the tokenUrl replacement for OAPI3 compliance (using sed)
66-
# Note: 'sed' is necessary to update the security block as you described
57+
# 2. Perform the tokenUrl replacement
6758
sed -i 's|"tokenUrl": "https://{tenantDomain}/oauth/token"|"tokenUrl": "https://your-tenant-domain.auth0.com/oauth/token"|g' docs-v2/main/docs/api2-3.1-internal.json
6859
6960
- name: 🧹 Scrape OpenAPI to MDX files
70-
# Run the Mintlify scraping command from the docs-v2 root
71-
# This generates all the Markdown files in the 'api-reference' folder
7261
run: |
7362
cd docs-v2/main
7463
npx @mintlify/scraping@latest openapi-file docs/api2-3.1-internal.json -o api-reference
7564
7665
- name: 💾 Commit and Push generated files
77-
# This action automatically stages, commits, and pushes any file changes
78-
# (the new/updated MDX files) back to the docs-v2 repo.
7966
uses: stefanzweifel/git-auto-commit-action@v5
8067
with:
81-
# Crucial: Specify the repository path where changes happened
8268
repository: docs-v2
8369
commit_message: "Automated: Update API reference from latest api2 spec"
8470
commit_user_name: 'GitHub Actions Bot'

0 commit comments

Comments
 (0)