Skip to content

feat: add workflow to auto-sync Management API docs#7577

Merged
kristof-siket merged 3 commits intomainfrom
feat/sync-management-api-docs
Mar 2, 2026
Merged

feat: add workflow to auto-sync Management API docs#7577
kristof-siket merged 3 commits intomainfrom
feat/sync-management-api-docs

Conversation

@kristof-siket
Copy link
Contributor

@kristof-siket kristof-siket commented Mar 2, 2026

Summary

Adds a GitHub Actions workflow (sync-management-api-docs.yml) that automatically keeps Management API documentation in sync after each production deployment.

Triggers:

  • repository_dispatch (management-api-updated) — fired automatically from the pdp-control-plane deploy pipeline
  • workflow_dispatch — for manual runs (testing/recovery)

What it does:

  1. Checks out the repo using BOT_TOKEN_DOCS_COMMIT (for push access)
  2. Installs dependencies
  3. Fetches the live OpenAPI spec from api.prisma.io/v1/doc
  4. Regenerates MDX stubs via fumadocs-openapi (generate-docs.ts)
  5. Commits and pushes if any MDX files changed (no empty commits)
  6. Triggers the Vercel deploy hook on every successful run (even without MDX changes, to pick up schema-only updates)

Concurrency: Uses a sync-management-api-docs group with cancel-in-progress: false to prevent parallel runs from conflicting.

Required secrets

These must be configured in this repo's Settings > Secrets and variables > Actions before the workflow can run:

Secret Purpose
BOT_TOKEN_DOCS_COMMIT GitHub PAT with push access to this repo (bypassing branch protection)
VERCEL_DEPLOY_HOOK_URL Vercel deploy hook URL for the docs project

Related

  • Spec: prisma/pdp-control-planeprojects/management-api-docs-sync/spec.md
  • Linear: PTL-1022
  • The corresponding repository_dispatch step in pdp-control-plane's deploy pipeline will be added in a follow-up PR.

Test plan

  • Add BOT_TOKEN_DOCS_COMMIT and VERCEL_DEPLOY_HOOK_URL secrets to this repo
  • Trigger the workflow manually via Actions > Sync Management API Docs > Run workflow
  • Verify it fetches the spec, generates stubs, and triggers a Vercel deploy
  • Run it a second time without spec changes and confirm no duplicate commit is created

Summary by CodeRabbit

  • Chores
    • Added an automated workflow to sync Management API documentation: it fetches the API specification, regenerates docs when changes are detected, commits and pushes updates, and triggers a deployment. The workflow can be run manually or via repository dispatch to keep published docs up to date.

Adds a GitHub Actions workflow that syncs Management API documentation
after each production deployment. Triggered via repository_dispatch
from pdp-control-plane or manually via workflow_dispatch.

The workflow fetches the live OpenAPI spec, regenerates MDX stubs using
fumadocs-openapi, commits any changes, and triggers a Vercel redeploy.
@vercel
Copy link

vercel bot commented Mar 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Mar 2, 2026 3:05pm
docs Ready Ready Preview, Comment Mar 2, 2026 3:05pm
eclipse Ready Ready Preview, Comment Mar 2, 2026 3:05pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abd02b0 and b71c7c0.

📒 Files selected for processing (1)
  • .github/workflows/sync-management-api-docs.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/sync-management-api-docs.yml

Walkthrough

Adds a new GitHub Actions workflow that generates management API docs from the OpenAPI spec, detects MDX changes under apps/docs/content/docs/management-api/, commits and pushes updates when present, and triggers a Vercel deployment via a webhook.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow - Documentation Sync
.github/workflows/sync-management-api-docs.yml
Adds a workflow triggered on repository_dispatch (type management-api-updated) and workflow_dispatch. Steps: checkout, setup pnpm and Node.js v20 (with pnpm cache), install deps, fetch OpenAPI from apps/docs, run a TypeScript doc-generation script, detect MDX changes under apps/docs/content/docs/management-api/ via git status, conditionally commit/push changes using a bot token, and call a Vercel deploy webhook with curl.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add workflow to auto-sync Management API docs' directly and clearly describes the main change—a new GitHub Actions workflow for automatically syncing Management API documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@argos-ci
Copy link

argos-ci bot commented Mar 2, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 1 removed Mar 2, 2026, 3:09 PM

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/sync-management-api-docs.yml (1)

63-64: Harden deploy-hook call with timeout and retries.

Line 64 has no timeout/retry policy. A transient network issue can fail the workflow even when docs sync succeeded.

Proposed hardening
-      - name: Trigger Vercel deploy
-        run: curl --fail -X POST "${{ secrets.VERCEL_DEPLOY_HOOK_URL }}"
+      - name: Trigger Vercel deploy
+        run: |
+          curl --fail --silent --show-error \
+            --max-time 30 \
+            --retry 3 \
+            --retry-delay 2 \
+            --retry-all-errors \
+            -X POST "${{ secrets.VERCEL_DEPLOY_HOOK_URL }}"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/sync-management-api-docs.yml around lines 63 - 64, The
"Trigger Vercel deploy" step currently runs a single curl without timeout or
retries; update this step to harden the deploy-hook call by adding a per-request
timeout and a retry policy—either replace the single curl invocation with a
retry loop that attempts curl up to N times with delays between attempts (and
uses curl options like --fail and --max-time) or use an existing retry action;
ensure the step still fails the job only after all retries are exhausted and
include clear logging of attempts and the final error.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/sync-management-api-docs.yml:
- Around line 42-52: Change detection step (id: changes) misses untracked MDX
files because it uses git diff --quiet on apps/docs/content/docs/management-api/
which ignores untracked files; replace the check with a command that detects
untracked and modified files (e.g., use git status --porcelain
apps/docs/content/docs/management-api/ or git ls-files -o --exclude-standard
apps/docs/content/docs/management-api/ and test for non-empty output) and then
set the GITHUB_OUTPUT "changed=true/false" and print the appropriate messages so
newly generated MDX files trigger the commit step.
- Around line 17-20: The workflow currently passes BOT_TOKEN_DOCS_COMMIT to
actions/checkout@v4 which exposes the write-scoped PAT for the entire job
(including the pnpm install step); change the flow so checkout does not use the
token, and instead configure authentication only at push time by (a) removing
token: ${{ secrets.BOT_TOKEN_DOCS_COMMIT }} from the actions/checkout@v4 step
and (b) adding a dedicated step before the git push that sets git credentials or
uses actions/setup-credentials (or similar) to inject BOT_TOKEN_DOCS_COMMIT just
for the push operation (refer to the checkout step and the push step that runs
git push or uses actions/github-script to ensure the token is applied only
there).

---

Nitpick comments:
In @.github/workflows/sync-management-api-docs.yml:
- Around line 63-64: The "Trigger Vercel deploy" step currently runs a single
curl without timeout or retries; update this step to harden the deploy-hook call
by adding a per-request timeout and a retry policy—either replace the single
curl invocation with a retry loop that attempts curl up to N times with delays
between attempts (and uses curl options like --fail and --max-time) or use an
existing retry action; ensure the step still fails the job only after all
retries are exhausted and include clear logging of attempts and the final error.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 897ec31 and abd02b0.

📒 Files selected for processing (1)
  • .github/workflows/sync-management-api-docs.yml

- Use persist-credentials: false on checkout and inject bot token only
  at push time to avoid exposing credentials during pnpm install
- Use git status --porcelain instead of git diff --quiet to detect both
  modified and newly created (untracked) MDX files
@kristof-siket kristof-siket merged commit 23f1198 into main Mar 2, 2026
9 of 13 checks passed
@kristof-siket kristof-siket deleted the feat/sync-management-api-docs branch March 2, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant