Skip to content

ci: isolate changed-line link check outputs - #24703

Open
lilin90 wants to merge 1 commit into
pingcap:masterfrom
lilin90:harden-link-fail-fast
Open

lilin90 wants to merge 1 commit into
pingcap:masterfrom
lilin90:harden-link-fail-fast

Conversation

@lilin90

@lilin90 lilin90 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What is changed, added, or deleted? (Required)

The changed-lines link check can mistake added Markdown text for a diff file header and write generated files through symlinks in the PR checkout. Recognize file headers only outside diff hunks and write the extracted lines, input lists, and Lychee report to a fresh runner temporary directory. The checkout also stops persisting credentials because this job only needs local Git operations after checkout.

Verified locally with real Git diffs and Lychee v0.24.2. The regression fixture can overwrite a helper before the change, while the updated workflow preserves the helper and still finds external links and site-relative href links.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

  • Related code change PR links (if applicable):
  • This PR is translated from:
  • Other reference link(s):

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • Chores
    • Automated link checks now handle added Markdown content more reliably, including lines that resemble file headers.
    • Link-check inputs and reports are kept in a temporary workspace rather than fixed files in the checkout.
    • Workflow paths are handled more consistently, and checkout credentials are no longer persisted.

@ti-chi-bot

ti-chi-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign overvenus for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added missing-translation-status This PR does not have translation status info. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The diff parser now collects added lines only within active hunks. The link-check workflow uses a temporary directory for extracted inputs, hrefs, and the Lychee report.

Changes: Link Check Workflow

Layer / File(s) Summary
Parse added lines within diff hunks
.github/scripts/extract-changed-markdown-lines.pl
The parser resets file and hunk state at each diff header. It collects added lines only within an active hunk and preserves content beginning with ++.
Pass link-check files through a temporary directory
.github/workflows/link-fail-fast.yaml
The workflow disables checkout credential persistence and uses a temporary directory under $RUNNER_TEMP for extracted inputs, hrefs, and the Lychee report.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: qiancai

Merge Risk: Minimal · up to c5b7c

This change hardens the changed-lines link check by parsing diff headers only outside hunks and keeping generated files out of the checkout. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "ci: isolate changed-line link check outputs" matches the main change. The PR writes the extracted lines, input lists, and Lychee report to a fresh runner temporary directory, and it stops t…
Description check Passed The description explains the change and the reason for it. It covers the file-header misdetection inside diff hunks, the move to a fresh runner temporary directory, and disabling checkout credential p…
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.
Full details: Title check

Explanation

The title "ci: isolate changed-line link check outputs" matches the main change. The PR writes the extracted lines, input lists, and Lychee report to a fresh runner temporary directory, and it stops the header-detection bug in the extraction script. The title is short, specific, and follows a conventional commit style. It does not name the header-detection fix, but it still covers the primary change.

Full details: Description check

Explanation

The description explains the change and the reason for it. It covers the file-header misdetection inside diff hunks, the move to a fresh runner temporary directory, and disabling checkout credential persistence. It also reports local verification with real Git diffs and Lychee v0.24.2. The template's required 'What is changed' section is filled in. The version checklist marks master, and the AI agent involvement section is ticked. The optional reference links are blank, and the template comments remain in place. These gaps are non-critical.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: db26e52
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b1b9c7f6-273d-4467-a338-0f15f97b1042
Commits

Reviewing files that changed from the base of the PR and between db26e52 and c5b7cda.

Files selected for processing: 2

  • .github/scripts/extract-changed-markdown-lines.pl
  • .github/workflows/link-fail-fast.yaml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@lilin90 lilin90 self-assigned this Nov 17, 2026
@lilin90
lilin90 requested a balanced review from Copilot November 17, 2026 07:58
@lilin90 lilin90 added the ONCALL Relates to documentation oncall. label Nov 17, 2026

Copilot AI 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.

🟢 Approval recommended

No active review issues were identified for the changed-line link-check workflow hardening.

No open issues 🎉

What changed in this PR

This PR hardens the changed-line link-check workflow by separating generated files from the PR checkout and preventing added Markdown text from being mistaken for diff file headers.

Changes:

  • Recognizes file headers only outside diff hunks while preserving added-line link detection.
  • Moves extracted content, input lists, and the Lychee report into a fresh runner temporary directory.
  • Disables persisted checkout credentials and quotes workflow paths.
File Description
.github/​workflows/​link-fail-fast.yaml Isolates generated inputs and reports in runner temporary storage and disables credential persistence.
.github/​scripts/​extract-changed-markdown-lines.pl Tracks diff hunk state to distinguish file headers from added Markdown content.

Review effort: Balanced

@lilin90 lilin90 added the translation/no-need No need to translate this PR. label Nov 17, 2026
@ti-chi-bot ti-chi-bot Bot removed the missing-translation-status This PR does not have translation status info. label Nov 17, 2026
@lilin90
lilin90 requested a review from qiancai November 17, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ONCALL Relates to documentation oncall. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. translation/no-need No need to translate this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants