Skip to content

fix(ci): unblock API docs auto-PR on cspell pre-commit failure#1117

Merged
upupming merged 3 commits into
mainfrom
fix/api-docs-cspell-skip-hooks
Jun 15, 2026
Merged

fix(ci): unblock API docs auto-PR on cspell pre-commit failure#1117
upupming merged 3 commits into
mainfrom
fix/api-docs-cspell-skip-hooks

Conversation

@upupming

@upupming upupming commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Background

The weekly Update API docs workflow (run that failed) failed at the Create Pull Request step.

peter-evans/create-pull-request runs its own git commit, which triggers the husky pre-commit hook (lint-stagedcspell/prettier). On the freshly generated genui docs, cspell flagged the identifier openui as an unknown word:

```
docs/en/api/genui/genui.openuirendererruntimeprops.md:164:5 - Unknown word (openui)
docs/en/api/genui/genui.openuirendererruntimeprops.response.md:7:5 - Unknown word (openui)
docs/zh/api/genui/... (same 2)
husky - pre-commit script failed (code 1)
```

The hook failed → the action aborted → no PR was opened.

Changes

  1. cspell.json — add openui to the dictionary (next to the existing genui); it's a legitimate auto-generated API identifier.
  2. .github/workflows/update-api-docs.yml — set HUSKY=0 on the Create Pull Request step so the action's internal commit skips the pre-commit hook. This is the documented husky equivalent of git commit -n. The auto-generated docs are already linted/prettified by the regeneration script, so running the staged-files hook again on this bot commit adds no value and only risks blocking the run on harmless new identifiers in the future.

Disable Husky pre-commit hooks in the Create Pull Request step of the update-api-docs workflow to unblock CI on auto-generated API docs
Add a hard-gated “Validate generated docs” step that runs scripts/ci/check-asset-urls.mjs for docs/en/api and docs/zh/api before creating the PR
Add openui to the cspell.json dictionary to prevent spell-check failures on generated API identifiers

Add 'openui' to the cspell dictionary (auto-generated genui API docs use
it as an identifier) and set HUSKY=0 on the Create Pull Request step so the
peter-evans action's internal commit skips the pre-commit hook, equivalent
to 'git commit -n'.
@upupming upupming requested a review from Huxpro as a code owner June 15, 2026 03:34
@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for lynx-doc ready!

Name Link
🔨 Latest commit a2a29a6
🔍 Latest deploy log https://app.netlify.com/projects/lynx-doc/deploys/6a2f76470238030008def6ee
😎 Deploy Preview https://deploy-preview-1117--lynx-doc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@upupming, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 15 minutes and 16 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2791dce2-4f03-47f1-a78b-02e6edcc8b7d

📥 Commits

Reviewing files that changed from the base of the PR and between 68eca42 and a2a29a6.

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

Walkthrough

Two CI configuration updates for the auto-generated API docs workflow: a new validation step checks generated documentation asset URLs before PR creation, the "Create Pull Request" step gains HUSKY: '0' to prevent pre-commit hooks from aborting, and cspell.json allows "openui" as a valid word.

Changes

Auto-Generated Docs Workflow Fixes

Layer / File(s) Summary
Validate generated docs before PR creation
.github/workflows/update-api-docs.yml
Adds a "Validate generated docs" step that runs check-asset-urls.mjs against docs/en/api and docs/zh/api directories as a hard gate before PR creation.
Skip Husky hooks and allow openui in cspell
.github/workflows/update-api-docs.yml, cspell.json
Sets env: HUSKY: '0' in the "Create Pull Request" step to bypass Husky pre-commit hooks that may fail on auto-generated documentation; adds "openui" to the cspell words allowlist.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • lynx-family/lynx-website#1050: Both PRs modify the same GitHub Actions workflow /.github/workflows/update-api-docs.yml for the generated API-docs pull request process.

Suggested reviewers

  • icecreamx10
  • Huxpro
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing a CI workflow that was blocked by cspell failing on auto-generated documentation, which is exactly what the PR addresses.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/api-docs-cspell-skip-hooks

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.

❤️ Share

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e39072b08

ℹ️ 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".

Comment thread .github/workflows/update-api-docs.yml
HUSKY=0 skips the whole pre-commit hook, including check-asset-urls.mjs.
Run that checker explicitly on the generated docs before creating the PR
so internal asset URLs can't leak into the public site unvalidated
(addresses Codex review).
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploying lynx-website-next with  Cloudflare Pages  Cloudflare Pages

Latest commit: a2a29a6
Status:⚡️  Build in progress...

View logs

@upupming

Copy link
Copy Markdown
Collaborator Author

Good catch — fixed in 68eca42. HUSKY=0 does skip the whole hook, so I added an explicit Validate generated docs step that runs node scripts/ci/check-asset-urls.mjs against docs/{en,zh}/api before the PR is created. It's a hard gate (no continue-on-error), so blocked internal asset URLs will fail the run rather than reach the draft PR. cspell/prettier stay skipped since they're just noise on auto-generated docs.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

81-81: ⚡ Quick win

Harden file argument passing for the docs validator.

$(find ...) is brittle for filenames with whitespace and can fail once argument size grows. Use null-delimited piping so the gate remains stable as docs expand.

Proposed change
-        run: node scripts/ci/check-asset-urls.mjs $(find docs/en/api docs/zh/api -type f)
+        run: find docs/en/api docs/zh/api -type f -print0 | xargs -0 -r node scripts/ci/check-asset-urls.mjs
🤖 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 at line 81, The check-asset-urls.mjs
command is using command substitution with $(find ...) which is fragile for
filenames with whitespace and can exceed argument limits as documentation grows.
Replace the command substitution approach with null-delimited piping by using
find with the -print0 flag and piping to xargs with the -0 flag, then passing
the files to the node scripts/ci/check-asset-urls.mjs script. This ensures
proper handling of special characters in filenames and scalability as more docs
files are added.
🤖 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.

Nitpick comments:
In @.github/workflows/update-api-docs.yml:
- Line 81: The check-asset-urls.mjs command is using command substitution with
$(find ...) which is fragile for filenames with whitespace and can exceed
argument limits as documentation grows. Replace the command substitution
approach with null-delimited piping by using find with the -print0 flag and
piping to xargs with the -0 flag, then passing the files to the node
scripts/ci/check-asset-urls.mjs script. This ensures proper handling of special
characters in filenames and scalability as more docs files are added.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 30a9d3bb-ba5f-489a-9f6e-4bdd1bc10738

📥 Commits

Reviewing files that changed from the base of the PR and between 6e39072 and 68eca42.

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

Re-implementing a husky/lint-staged check inside the workflow duplicates
logic that can drift whenever the pre-commit setup changes. Keep HUSKY=0
to skip the hook; rely on the draft PR review (and any CI on it) to catch
issues instead.
@upupming upupming merged commit b5a00c5 into main Jun 15, 2026
12 of 13 checks passed
@upupming upupming deleted the fix/api-docs-cspell-skip-hooks branch June 15, 2026 03:56
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