Skip to content

fix: build API docs before Hugo in PR preview workflow#6908

Open
Copilot wants to merge 5 commits intomasterfrom
copilot/fix-pr-preview-api-pages
Open

fix: build API docs before Hugo in PR preview workflow#6908
Copilot wants to merge 5 commits intomasterfrom
copilot/fix-pr-preview-api-pages

Conversation

Copy link
Contributor

Copilot AI commented Mar 8, 2026

API doc content files (content/*/api/**/_index.html) are generated by redoc-cli via generate-api-docs.sh and are gitignored. The PR preview workflow triggered on api-docs/** changes but never ran the build step, so Hugo had nothing to render for /api pages.

Changes

.github/workflows/pr-preview.yml

  • Added "Build API docs" step (yarn run build:api-docs) that runs before Hugo when has-api-doc-changes == 'true'

.github/scripts/detect-preview-pages.js

  • Added detectApiPages() — maps changed api-docs/{product}/{version}/** files to their preview URLs by parsing each product's .config.yml and extracting API keys:
    api-docs/influxdb3/core/v3/influxdb3-core-openapi.yaml
      → /influxdb3/core/api/v3/
    
  • Added Strategy 2: auto-detect affected API pages from apiDocs file changes, so PR body URLs are no longer required for API-only PRs
  • Added has-api-doc-changes output consumed by the workflow
  • Fixed needs-author-input logic: only fires when no pages were detected by any strategy (content, API auto-detect, or PR body URLs)
Original prompt

Pull request: #6906

pr preview doesn't work for the /api pages


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

jstirnaman and others added 2 commits March 8, 2026 16:00
Rename Core and Enterprise OpenAPI spec files from ref.yml to
descriptive names (influxdb3-core-openapi.yaml, influxdb3-enterprise-openapi.yaml).
Copy specs to static/openapi/ and add download links in the API description.
- Add detectApiPages() to detect-preview-pages.js to auto-map changed
  api-docs/ files to their content URL paths via .config.yml
- Add has-api-doc-changes output to detect-preview-pages.js
- Fix needs-author-input logic to not request input when API pages
  are already auto-detected
- Add Build API docs step to pr-preview.yml that runs yarn run
  build:api-docs before the Hugo build when api-doc changes detected

Co-authored-by: jstirnaman <212227+jstirnaman@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix pr preview for api pages fix: build API docs before Hugo in PR preview workflow Mar 8, 2026
@jstirnaman jstirnaman marked this pull request as ready for review March 9, 2026 15:00
@jstirnaman jstirnaman requested a review from a team as a code owner March 9, 2026 15:00
@jstirnaman jstirnaman requested review from jstirnaman and removed request for a team March 9, 2026 15:00
@jstirnaman jstirnaman changed the base branch from feat/v3.8-api-specs to master March 9, 2026 15:02
@jstirnaman jstirnaman added the waiting:pr Blocked on another PR merging first label Mar 13, 2026
@jstirnaman
Copy link
Contributor

jstirnaman commented Mar 13, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting:pr Blocked on another PR merging first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants