Skip to content

Commit 97eddb7

Browse files
committed
ci(docs): refresh main docs preview on push
Add a workflow that fires on docs-touching pushes to main and re-triggers Mintlify's preview for the main branch. Gives the team a persistent superdoc-main.mintlify.app URL that always reflects the current state of main, without anyone needing to open a draft PR. Production docs continue to come from docs-stable so this is purely additive.
1 parent e754e3b commit 97eddb7

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Refreshes the persistent Mintlify preview for `main` so the team can see the
2+
# current "next" state of the docs at superdoc-main.mintlify.app without
3+
# opening a draft PR. Mintlify reuses the URL per branch, so each push
4+
# refreshes content in place. Production docs stay on docs-stable; this is
5+
# unrelated to the production gate.
6+
name: 👀 Refresh main docs preview
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- 'apps/docs/**'
14+
- 'packages/document-api/src/contract/**'
15+
- 'scripts/generate-all.mjs'
16+
17+
permissions:
18+
contents: read
19+
20+
concurrency:
21+
group: refresh-main-docs-preview
22+
cancel-in-progress: true
23+
24+
jobs:
25+
trigger-preview:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Trigger Mintlify preview for main
29+
env:
30+
MINTLIFY_API_KEY: ${{ secrets.MINTLIFY_API_KEY }}
31+
MINTLIFY_PROJECT_ID: ${{ secrets.MINTLIFY_PROJECT_ID }}
32+
run: |
33+
set -euo pipefail
34+
if [ -z "${MINTLIFY_API_KEY}" ] || [ -z "${MINTLIFY_PROJECT_ID}" ]; then
35+
echo "MINTLIFY_API_KEY or MINTLIFY_PROJECT_ID not set; skipping."
36+
exit 0
37+
fi
38+
39+
response=$(curl -sS -X POST \
40+
-H "Authorization: Bearer ${MINTLIFY_API_KEY}" \
41+
-H "Content-Type: application/json" \
42+
-d '{"branch": "main"}' \
43+
"https://api.mintlify.com/v1/project/preview/${MINTLIFY_PROJECT_ID}")
44+
45+
echo "Mintlify response: ${response}"
46+
preview_url=$(echo "${response}" | jq -r '.previewUrl // empty')
47+
48+
if [ -n "$preview_url" ]; then
49+
{
50+
echo "## Next docs preview refreshed"
51+
echo
52+
echo "URL: $preview_url"
53+
} >> "$GITHUB_STEP_SUMMARY"
54+
fi

0 commit comments

Comments
 (0)