-
Notifications
You must be signed in to change notification settings - Fork 856
DC-5259 Added Lychee Link Checker #7192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Dangerous URL checkNo absolute URLs to prisma.io/docs found. |
WalkthroughAdds a GitHub Actions workflow (.github/workflows/lychee.yml) that runs on pull_request to run lycheeverse/lychee-action@v2, fails on link errors, and on failure creates an issue from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Comment |
Redirect checkThis PR probably requires the following redirects to be added to static/_redirects:
|
Deploying docs with
|
Latest commit: |
d1c5be6
|
Status: | ✅ Deploy successful! |
Preview URL: | https://a9f72b1a.docs-51g.pages.dev |
Branch Preview URL: | https://dc-5259-lychee-link-checker.docs-51g.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/lychee.yml (1)
2-2
: Consider adding manual and scheduled triggers.Add
workflow_dispatch
and a weeklyschedule
to catch rot outside PRs.-on: [pull_request] +on: + pull_request: + workflow_dispatch: + schedule: + - cron: '0 6 * * 1' # Mondays 06:00 UTC
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/lychee.yml
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Check internal links
- GitHub Check: runner / linkspector
- GitHub Check: Cloudflare Pages
.github/workflows/lychee.yml
Outdated
- name: Link Checker | ||
id: lychee | ||
uses: lycheeverse/lychee-action@v2 | ||
with: | ||
fail: true | ||
|
||
- name: Create Issue From File | ||
if: steps.lychee.outputs.exit_code != 0 | ||
uses: peter-evans/create-issue-from-file@v5 | ||
with: | ||
title: Link Checker Report | ||
content-filepath: ./lychee/out.md | ||
labels: report, automated issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create-issue step will never run; missing lychee output file. Fix failure flow and configure output.
fail: true
causes the job to stop on Line 14; the “Create Issue From File” step won’t run../lychee/out.md
is never produced; nooutput
/format
configured for the action.- Step condition should use expression syntax; also guard for forked PRs to avoid permission failures.
Apply this diff to make the report creation reliable and still fail the job:
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
+ continue-on-error: true
with:
- fail: true
+ # Let the workflow control failure after creating the issue
+ fail: false
+ # Use the token to improve rate limits (e.g. GitHub links)
+ token: ${{ secrets.GITHUB_TOKEN }}
+ # Produce a markdown report file for the next step
+ format: markdown
+ output: ./lychee/out.md
+
+ - name: Ensure report directory exists
+ run: mkdir -p lychee
- name: Create Issue From File
- if: steps.lychee.outputs.exit_code != 0
+ if: ${{ steps.lychee.outputs.exit_code != 0 && github.event.pull_request.head.repo.fork == false }}
uses: peter-evans/create-issue-from-file@v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: report, automated issue
+
+ - name: Fail workflow if broken links found
+ if: ${{ steps.lychee.outputs.exit_code != 0 }}
+ run: exit 1
This preserves PR failure on bad links, creates the issue when possible, and avoids write attempts from forked PRs.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/lychee-action@v2 | |
with: | |
fail: true | |
- name: Create Issue From File | |
if: steps.lychee.outputs.exit_code != 0 | |
uses: peter-evans/create-issue-from-file@v5 | |
with: | |
title: Link Checker Report | |
content-filepath: ./lychee/out.md | |
labels: report, automated issue | |
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/lychee-action@v2 | |
continue-on-error: true | |
with: | |
# Let the workflow control failure after creating the issue | |
fail: false | |
# Use the token to improve rate limits (e.g. GitHub links) | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# Produce a markdown report file for the next step | |
format: markdown | |
output: ./lychee/out.md | |
- name: Ensure report directory exists | |
run: mkdir -p lychee | |
- name: Create Issue From File | |
if: ${{ steps.lychee.outputs.exit_code != 0 && github.event.pull_request.head.repo.fork == false }} | |
uses: peter-evans/create-issue-from-file@v5 | |
with: | |
title: Link Checker Report | |
content-filepath: ./lychee/out.md | |
labels: report, automated issue | |
- name: Fail workflow if broken links found | |
if: ${{ steps.lychee.outputs.exit_code != 0 }} | |
run: exit 1 |
🤖 Prompt for AI Agents
.github/workflows/lychee.yml lines 12-24: the lychee action is currently
configured with fail: true so the job stops and the "Create Issue From File"
step never runs, and no output file is configured; change lychee to run
non-fatal (set fail: false) and configure its output format/file (e.g., format:
md and output: ./lychee/out.md) so the action produces ./lychee/out.md and
exposes an exit_code output, update the Create Issue step to use the expression
syntax for the condition (if: steps.lychee.outputs.exit_code != '0') and
additionally guard against runs from forked PRs by checking the repo identity
(e.g., if: steps.lychee.outputs.exit_code != '0' &&
github.event.pull_request.head.repo.full_name == github.repository) so it won't
attempt to write from forks, and finally add a short step after to fail the job
when exit_code != '0' (run: exit 1 with the same guarded if) so the workflow
still fails on bad links while allowing report creation when permitted.
Summary by CodeRabbit