mirror of
https://github.com/ComposioHQ/composio.git
synced 2026-09-22 11:46:35 +08:00
3335bb3013
This PR: - fixes a regression introduced by https://github.com/ComposioHQ/composio/pull/3956: fumadocs-openapi 11's `groupBy: 'tag'` silently skips operations whose tag is not declared in the document's top-level `tags` array, which 404'd all 16 Projects and Organization Management operation pages (e.g. `/reference/api-reference/projects/postProjectUsageSummary`) on both v3.1 and v3, and dropped them from the sitemap and search index - adds `declareOperationTags()` (`docs/lib/openapi-tags.ts`), applied at spec load time in `lib/openapi.ts` (covers build-time-fetched specs) and at sync time in `scripts/fetch-openapi.mjs`, which now also warns when the upstream payload omits tags; the checked-in specs are normalized accordingly (purely additive) - adds CI guards in `tests/static/api-reference-routes.test.ts`: spec invariants (every visible operation has a tag and `operationId`), bidirectional spec-vs-generated-routes set equality through the production loader path, a negative test pinning fumadocs' silent-drop behavior (fails when upstream fixes it, signaling the workaround can be retired), and validation that every `ApiEndpointsTable` quick-link href resolves to a generated page - extends `Docs - Check Links` with a nightly (02:30 UTC) + manual external-URL sweep via a new `lint:links:external` script; the validator only fails on evidence a link is dead (404/410 or repeated network errors, with UA/timeout/GET-fallback/retry and per-URL caching) and scheduled failures file a deduplicated tracking issue; PR runs keep the fast internal-only check - fixes six dead external links the first sweep found (moved Claude Agent SDK docs, stale dashboard settings URL ×2, a `master`-branch path now pinned to tag `0.5.0+post.1`, and two removed `ComposioHQ` example repos whose mentions were dropped — their code is embedded in the pages via `RepoBrowser`) ## Context fumadocs-openapi 10 generated a page for any tag string found on an operation; v11 requires the tag to be declared top-level and skips silently otherwise (`preset-auto.js`: `builder.fromTagName(tag)` → `continue`, no warning). The backend spec generator omits `Projects`, `Organization Management`, and `Invite Codes` from `tags`, so their operation pages vanished while the checked-in MDX tag landing pages kept rendering with dead quick links. With the normalizer, the generated URL set is byte-identical to the pre-#3956 set (234 routes, verified via `getReferenceSource().getPages()` diff); no revert needed. Existing checks missed this because `lint:links` only extracts markdown links and `Card` hrefs (the dead links live in `ApiEndpointsTable`'s array prop) and validates against the same loader that shrank, and the integration suite samples fixed routes under tags that survived. The new completeness guard derives expectations from the specs themselves, so routine data syncs don't churn it.
99 lines
3.5 KiB
YAML
99 lines
3.5 KiB
YAML
name: Docs - Check Links
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'docs/**'
|
|
- '.github/actions/setup-node-pnpm-bun/action.yml'
|
|
- '.github/workflows/docs-check-links.yml'
|
|
- 'mise.toml'
|
|
- 'mise.lock'
|
|
schedule:
|
|
# Nightly external-link sweep. HEAD/GET-checking every external URL is
|
|
# slow and depends on third-party uptime, so it never runs on the PR path.
|
|
- cron: '30 2 * * *'
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check-links:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ./docs
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Setup Node.js, pnpm, Bun
|
|
uses: ./.github/actions/setup-node-pnpm-bun
|
|
|
|
- name: Cache bun dependencies
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ~/.bun/install/cache
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('docs/bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Validate internal links
|
|
if: github.event_name == 'pull_request'
|
|
run: bun run lint:links
|
|
|
|
- name: Validate internal and external links
|
|
if: github.event_name != 'pull_request'
|
|
run: bun run lint:links:external
|
|
|
|
# A red scheduled run is invisible unless someone watches the Actions
|
|
# tab. File one tracking issue and leave it open until the cause is
|
|
# fixed; PR runs skip this because their failures are already visible.
|
|
- name: Open tracking issue on failure
|
|
if: failure() && github.event_name != 'pull_request'
|
|
continue-on-error: true
|
|
# Override the job-level `./docs` default: that path only exists after
|
|
# checkout, and a pre-checkout failure would otherwise leave the runner
|
|
# unable to start this shell, silently losing the alert.
|
|
working-directory: ${{ github.workspace }}
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GH_REPO: ${{ github.repository }}
|
|
LABEL: docs-external-links-failure
|
|
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
run: |
|
|
gh label create "$LABEL" \
|
|
--color B60205 \
|
|
--description "Nightly docs external-link check is failing" 2>/dev/null || true
|
|
|
|
existing=$(gh issue list --label "$LABEL" --state open --limit 1 --json number --jq '.[0].number // empty')
|
|
if [ -n "$existing" ]; then
|
|
echo "Issue #$existing is already open for this failure; not filing a duplicate."
|
|
exit 0
|
|
fi
|
|
|
|
gh issue create \
|
|
--title "Nightly docs external-link check is failing" \
|
|
--label "$LABEL" \
|
|
--body "The scheduled \`Docs - Check Links\` external sweep failed.
|
|
|
|
- Run: $RUN_URL
|
|
- Trigger: \`$EVENT_NAME\`
|
|
|
|
The failing URLs are listed in the run log. External links only fail on
|
|
evidence they are dead (404/410, or repeated network errors), so this
|
|
usually means a linked page moved or was taken down — fix or remove the
|
|
link in \`docs/content\`."
|