ci(api-docs): weekly workflow to regenerate API docs from lynx-stack#1050
Conversation
✅ Deploy Preview for lynx-doc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds a weekly/manual GitHub Actions workflow and a Bash script to regenerate API docs from a lynx-stack checkout, sync rspeedy-generated markdown into ChangesAPI Documentation Automation Setup
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying lynx-website-next with
|
| Latest commit: |
7d4e223
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2fb123ed.lynx-website-next.pages.dev |
| Branch Preview URL: | https://ci-auto-update-api-docs.lynx-website-next.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/update-api-docs.yml (1)
7-11: ⚡ Quick winAdd workflow concurrency to avoid branch update races.
This workflow can be triggered by cron and manual dispatch, but both write to
bot/update-api-docs. A concurrency group prevents overlapping runs from contending on the same branch.Suggested fix
on: schedule: - cron: '0 18 * * 0' # Weekly, Sunday 18:00 UTC workflow_dispatch: +concurrency: + group: update-api-docs + cancel-in-progress: false + permissions: {}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/update-api-docs.yml around lines 7 - 11, Add a top-level "concurrency" configuration to the workflow to prevent overlapping runs writing to the same branch (use a stable group name like "bot/update-api-docs" or include the branch name) and set "cancel-in-progress" to true so newer runs cancel older ones; place this concurrency block at the top level of the workflow YAML (alongside "on", not inside a job) to ensure both the cron and workflow_dispatch triggers use the same concurrency group.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/update-api-docs.yml:
- Around line 24-33: Update both checkout steps ("Checkout lynx-website" and
"Checkout lynx-stack") to disable credential persistence by adding
persist-credentials: false to their actions/checkout@... invocations, and add a
workflow-level concurrency key (e.g., a group using the workflow name and branch
or run id) to the workflow so runs that write to the fixed branch
bot/update-api-docs don't overlap; reference the step names and the branch
bot/update-api-docs when making these changes.
In `@scripts/update-api-docs.sh`:
- Around line 69-79: Guard the empty-glob cases in the two sync loops by
skipping iterations when the glob didn’t match and use rm -f for safe removals:
inside the first loop over "$web"/*.md and the second over "$gen"/*.md, add a
check like [ -e "$f" ] || continue (so the loop skips the literal "*.md" when
there are no matches) and replace rm "$f" with rm -f "$f"; keep the existing
basename (bn="$(basename "$f")") and cp "$f" "$web/$bn" but likewise guard the
cp loop with [ -e "$f" ] || continue so cp is never invoked on a non-existent
literal glob.
---
Nitpick comments:
In @.github/workflows/update-api-docs.yml:
- Around line 7-11: Add a top-level "concurrency" configuration to the workflow
to prevent overlapping runs writing to the same branch (use a stable group name
like "bot/update-api-docs" or include the branch name) and set
"cancel-in-progress" to true so newer runs cancel older ones; place this
concurrency block at the top level of the workflow YAML (alongside "on", not
inside a job) to ensure both the cron and workflow_dispatch triggers use the
same concurrency group.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d295d0c2-b7cb-43c5-ad47-676fb95505f2
📒 Files selected for processing (3)
.github/workflows/update-api-docs.yml.gitignorescripts/update-api-docs.sh
Address CodeRabbit review on #1050: - persist-credentials: false on both actions/checkout (avoid leaving GITHUB_TOKEN in git config for later steps); peter-evans/create-pull-request uses its own auth. - concurrency group to serialize schedule + workflow_dispatch runs that write to the same bot/update-api-docs branch. Change-Id: Ide8e5890e09ef24277ae3492404c395bf0e1f679
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05308ab331
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/update-api-docs.yml:
- Around line 8-10: Remove the temporary push trigger added for the PR by
deleting the block that sets push: branches: [ci/auto-update-api-docs] (and the
adjacent comment "# TEMP: validation run on the PR branch — remove before
merge.") from the workflow so the workflow no longer triggers on pushes to the
ci/auto-update-api-docs branch.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7c0f945f-1b06-4f9e-a504-6bd9652264ec
📒 Files selected for processing (1)
.github/workflows/update-api-docs.yml
Adds a scheduled (weekly) + manual workflow that regenerates the lynx-stack-derived API reference docs and opens a draft PR for review. Runs entirely in lynx-website — no changes to the lynx-stack release pipeline and no cross-repo secrets. - rspeedy/*: build lynx-stack main, run API Extractor + API Documenter, sync. - reactlynx-testing-library / lynx-testing-environment: TypeDoc against the freshly built lynx-stack packages overlaid into node_modules (so the testing-library README and unpublished testing-environment are available). - Sets up Rust 1.92.0 + wasm targets for lynx-stack's wasm build. - run-typedoc post-process normalizes site links and escapes MDX braces. - persist-credentials: false on checkouts; concurrency group serializes runs. - Build validated in-job; opens a draft PR via peter-evans/create-pull-request. scripts/update-api-docs.sh is also runnable locally: bash scripts/update-api-docs.sh <lynx-stack-dir> Change-Id: Ibc8624cb0df8cccdb79bb3f953cbaa51f357c6a0
d49cae4 to
7d4e223
Compare
What
Adds a scheduled (weekly) + manual workflow that regenerates the lynx-stack-derived API reference docs and opens a draft PR for review. Runs entirely in lynx-website — no changes to the lynx-stack release pipeline and no cross-repo secrets.
scripts/update-api-docs.sh— orchestration (also runnable locally:bash scripts/update-api-docs.sh <lynx-stack-dir>)..github/workflows/update-api-docs.yml— weekly cron +workflow_dispatch, opens a draft PR viapeter-evans/create-pull-request.Pipeline
main, build, run API Extractor + API Documenter, sync intodocs/{en,zh}/api/rspeedy.node_modules(so the testing-library README the published@lynx-js/reactomits, and the unpublished@lynx-js/testing-environment, are available).run-typedocpost-process hook normalizes site links and escapes MDX braces, so output builds without manual fixups.pnpm run build) since GITHUB_TOKEN-created PRs don't trigger CI; the result is shown in the generated PR body.Validation (real CI run)
Triggered a real run on GitHub via a temporary
pushtrigger on this branch (sinceworkflow_dispatchrequires the workflow to be on the default branch first). The temporary trigger has been removed. It took three iterations to get the CI environment right:@lynx-js/react-transform,web-core→build:wasm) which need a Rust toolchain — not present.actions-rust-lang/setup-rust-toolchain, butrustupcouldn't on-demand sync lynx-stack's pinned channel (itsrust-toolchain.tomllives in.lynx-stack/, not auto-detected at the repo root).1.92.0+ targetswasm32-unknown-unknown,wasm32-wasip1explicitly → all steps green.Final successful run: https://github.com/lynx-family/lynx-website/actions/runs/26519179834 (~9.5 min)
This confirms end-to-end: the lynx-stack wasm build, doc generation, the full-site build gate, and the create-PR step all work — and the job is idempotent (no spurious PR when docs are already up to date, which was the case here since #1049 had merged).
Known limitations (surfaced in the generated PR's reviewer checklist)
docs/{en,zh}/api/_meta.jsonsidebar nav is not auto-reconciled (added/removed members need a manual nav edit).docs/{en,zh}/api/reactis not auto-regenerated (bespoke: custom intro + projectDocuments whose sources don't ship).Set up weekly automated API documentation regeneration from lynx-stack