Skip to content

docs: update for pipecat PR #4780 #72

docs: update for pipecat PR #4780

docs: update for pipecat PR #4780 #72

name: Mintlify Preview
# Mintlify auto-previews only fire for PRs into the *deployment* branch, which
# is now `production`. This workflow restores preview coverage for the staging
# flow:
# - push to main -> redeploy the stable "main" staging preview
# - pull_request->main -> create/update a per-branch preview, posted on the PR
#
# Requires two repo configuration values:
# - secret MINTLIFY_API_KEY (admin API key, prefixed `mint_`)
# - variable MINTLIFY_PROJECT_ID (from the Mintlify API keys page)
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
pull-requests: write
# One preview run per ref at a time; newer pushes supersede in-flight ones.
concurrency:
group: mintlify-preview-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
preview:
runs-on: ubuntu-latest
# Skip PRs from forks — repo secrets aren't available to them.
if: >-
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Determine branch
id: branch
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "name=${{ github.head_ref }}" >> "$GITHUB_OUTPUT"
else
echo "name=main" >> "$GITHUB_OUTPUT"
fi
- name: Trigger Mintlify preview
id: preview
env:
BRANCH: ${{ steps.branch.outputs.name }}
PROJECT_ID: ${{ vars.MINTLIFY_PROJECT_ID }}
API_KEY: ${{ secrets.MINTLIFY_API_KEY }}
run: |
response=$(curl -sS -X POST \
"https://api.mintlify.com/v1/project/preview/${PROJECT_ID}" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg b "$BRANCH" '{branch: $b}')")
echo "$response"
url=$(echo "$response" | jq -r '.previewUrl // empty')
if [ -z "$url" ]; then
echo "::error::Failed to trigger preview for branch '$BRANCH'"
exit 1
fi
echo "url=$url" >> "$GITHUB_OUTPUT"
echo "### 🔍 Mintlify preview for \`$BRANCH\`: $url" >> "$GITHUB_STEP_SUMMARY"
- name: Upsert preview comment on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
env:
PREVIEW_URL: ${{ steps.preview.outputs.url }}
with:
script: |
const marker = '<!-- mintlify-preview -->';
const body = `${marker}\n🔍 **Mintlify preview** for this branch: ${process.env.PREVIEW_URL}`;
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const { data: comments } = await github.rest.issues.listComments({
owner, repo, issue_number,
});
const existing = comments.find((c) => c.body && c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner, repo, comment_id: existing.id, body,
});
} else {
await github.rest.issues.createComment({
owner, repo, issue_number, body,
});
}