Create Link Validator workflow#81
Conversation
WalkthroughA new GitHub Actions workflow for link validation has been added, which runs on pull requests targeting the main branch. The Astro configuration was updated to conditionally include the Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHub Actions
participant CI Workflow
participant Astro Config
participant TypeDoc Config
Developer->>GitHub Actions: Open PR to main branch
GitHub Actions->>CI Workflow: Trigger "CI - Link Validator"
CI Workflow->>Astro Config: Set CHECK_LINKS=true
CI Workflow->>TypeDoc Config: Set CHECK_LINKS=true
Astro Config->>Astro Config: Conditionally include starlightLinksValidator
TypeDoc Config->>TypeDoc Config: Disable production mode if CHECK_LINKS is set
CI Workflow->>CI Workflow: Run link validation steps
Possibly related PRs
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (6)
typedoc.config.ts (2)
62-62: Consider simplifying the condition.The condition
isLinkCheck === falsecould be simplified to!isLinkCheckfor better readability.-const isProd = isLinkCheck === false && process.env.NODE_ENV === 'production'; +const isProd = !isLinkCheck && process.env.NODE_ENV === 'production';
60-62: Add a comment explaining the link checking logic.It would be helpful to add a comment explaining why TypeDoc plugins should be disabled during link checking.
+// When CHECK_LINKS is set, we disable TypeDoc plugins (isProd becomes false) +// to improve performance and prevent link validation errors in generated docs const isLinkCheck = !!process.env.CHECK_LINKS; const isProd = isLinkCheck === false && process.env.NODE_ENV === 'production';.github/workflows/ci-link-validator.yml (3)
17-17: Pin action version with a comment.While using a hash-pinned version of actions/checkout is good for security, it would be helpful to add a comment indicating which version this hash corresponds to.
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.1
18-18: Remove trailing whitespace.There's unnecessary trailing whitespace on this line.
- +🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 18-18: trailing spaces
(trailing-spaces)
22-23: Consider adding output handling for link check results.The workflow would benefit from explaining how link validation results are processed and reported.
- name: Run Link Check run: pnpm ci:build + # Link validation errors will cause the build to fail automaticallyastro.config.mts (1)
19-23: Add a comment explaining TypeDoc exclusion.It would be helpful to explain why TypeDoc paths are excluded from link checking.
starlightLinksValidator({ errorOnFallbackPages: false, errorOnInconsistentLocale: true, + // Exclude TypeDoc paths as they contain auto-generated content with many internal links exclude: ['/*/typedoc/**/*'], }),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/ci-link-validator.yml(1 hunks)astro.config.mts(3 hunks)typedoc.config.ts(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/ci-link-validator.yml
[error] 18-18: trailing spaces
(trailing-spaces)
🔇 Additional comments (5)
typedoc.config.ts (1)
60-61: Good addition for conditional link checking.The addition of the
isLinkCheckvariable provides a clean way to detect when link validation is happening..github/workflows/ci-link-validator.yml (1)
1-24: Good implementation of the link validator workflow.The workflow is properly set up to run on PRs to the main branch and correctly sets the
CHECK_LINKSenvironment variable.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 18-18: trailing spaces
(trailing-spaces)
astro.config.mts (3)
5-5: Good import addition.The import for
starlightLinksValidatoris correctly added.
17-25: Good implementation of conditional link validation.The conditional inclusion of the link validator plugin is well-structured, making it only active when the
CHECK_LINKSenvironment variable is set.
147-147: Correctly integrated the conditional link validator.The spread operator is properly used to conditionally include the link validator in the plugins array.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
.github/workflows/ci-link-validator.yml (3)
3-7: Consider expanding triggers
Currently, link validation only runs on pull requests targetingmain. If you also want to catch broken links on direct pushes or merges (e.g., fast‐forwards tomain), consider adding apushevent or aworkflow_runtrigger to cover those cases.
12-14: Ensure Node setup & caching for performance
This workflow relies on your custom install action to provision Node and dependencies, but it may benefit from an explicitactions/setup-nodestep (to lock down the Node version) and caching of the PNPM store ornode_modulesto speed up subsequent runs.
17-18: Remove trailing spaces and standardize checkout pinning
Line 18 has trailing whitespace (YAMLlint error). Also, instead of a raw commit SHA, you could referenceactions/checkout@v4for clarity and maintainability.Apply this diff:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + uses: actions/checkout@v4🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 18-18: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/ci-link-validator.yml(1 hunks)astro.config.mts(3 hunks)typedoc.config.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- astro.config.mts
- typedoc.config.ts
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/ci-link-validator.yml
[error] 18-18: trailing spaces
(trailing-spaces)
🔇 Additional comments (2)
.github/workflows/ci-link-validator.yml (2)
8-11: Descriptive job configuration
The job name (Run Starlight Link Check) andruns-on: ubuntu-latestare clear and appropriate. No issues here.
22-23: Verify build command invokes link checker
This step runspnpm ci:build, which should respectCHECK_LINKS=trueto activate your link‐validation plugin. Please confirm thatci:buildactually performs link validation (and not just a standard production build). If you only need link checking here, consider a dedicated script likepnpm link:check.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.github/workflows/ci-link-validator.yml (1)
19-19: Pin the install action for reproducibility
Using…/install@mainmay introduce breaking changes if the action’s default branch is updated. Pin to a released tag or specific commit SHA (e.g.,@v1.2.3or a known SHA).
🧹 Nitpick comments (3)
.github/workflows/ci-link-validator.yml (3)
15-15: Use a stable checkout action version
Pinning to a named tag (e.g.,actions/checkout@v4) is clearer and easier to update than a raw commit SHA:- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - uses: actions/checkout@v4
16-16: Remove trailing whitespace
YAMLLint reports a trailing space here. Please remove any extraneous spaces to satisfy linting.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 16-16: trailing spaces
(trailing-spaces)
20-22: Optimize dependency installation and caching
Consider adding a cache step to speed up pnpm installs between runs and reduce network usage. For example:- name: Cache pnpm store uses: actions/cache@v3 with: path: ~/.pnpm-store key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - name: Install dependencies run: pnpm install --frozen-lockfileAlso verify that
pnpm ci:buildindeed invokes the link checker (pnpm run ci:build).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci-link-validator.yml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/ci-link-validator.yml
[error] 16-16: trailing spaces
(trailing-spaces)
🔇 Additional comments (1)
.github/workflows/ci-link-validator.yml (1)
1-2: Workflow name is descriptive
Thename: CI - Link Validatorclearly communicates the purpose of this workflow.
Description
Summary by CodeRabbit