Skip to content

Gate pull requests on links in the files they change - #181

Merged
oruebel merged 3 commits into
mainfrom
link-check-changed-files
Sep 20, 2026
Merged

oruebel merged 3 commits into
mainfrom
link-check-changed-files

Conversation

@rly

@rly rly commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

The link check ran over every content file with fail: false, so broken links in a pull request landed in the job summary while the check itself reported success. PR #180 is the example: lychee correctly flagged all three 404s in the new news post, and the check was still green.

The reason fail: false was there is real. Archived event pages carry roughly 35 dead links, so a repo-wide blocking check would fail every PR.

What changed

Two jobs, split by event:

Job Runs on Checks Fails the run
pr_link_check pull_request only the content/** files the PR adds or edits yes
full_link_check schedule, workflow_dispatch all of content/** no (advisory)

New links get a real gate. The pre-existing dead links stay advisory on the weekly sweep, where they can be triaged separately.

The PR file list comes from the GitHub API (pulls/{n}/files) rather than a git diff against the base ref. The API needs no merge base, so a shallow checkout is enough, and it is exact about renames and deletions.

Shared lychee flags moved to a workflow-level LYCHEE_ARGS env var so the two jobs cannot drift apart. The workflow also now declares a read-only permissions: block covering just the reads these jobs perform.

Two incidental fixes: the trigger comment said "dev branch" while the trigger is main, and the id: lychee on a step nothing referenced is gone.

Verification

A test commit on this branch adds a content file with a deliberately broken link, to confirm the PR job actually goes red. That commit is reverted once the run is observed.

🤖 Generated with Claude Code

The link check ran over every content file with fail: false, so broken
links in a pull request were reported in the job summary but the check
still reported success. Dead links in archived event pages are the
reason the run could not be made blocking as a whole.

Split the workflow into two jobs. Pull requests check only the content
files they add or edit and fail when a link in those files is broken.
The weekly sweep and manual runs keep the repo-wide advisory report.

The pull request file list comes from the GitHub API rather than a git
diff against the base ref, which needs no merge base and so avoids the
full-history fetch a shallow checkout would otherwise require.

Shared lychee flags move to a workflow-level LYCHEE_ARGS env var so the
two jobs stay in step, and the token is narrowed to the reads the jobs
actually perform.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for nwborg ready!

Name Link
🔨 Latest commit ae04ae3
🔍 Latest deploy log https://app.netlify.com/projects/nwborg/deploys/6aaa2064a6e71e0008b9a9d0
😎 Deploy Preview https://deploy-preview-181--nwborg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

rly and others added 2 commits September 15, 2026 21:50
Confirms the pull request link check fails on a broken link. Reverted
once the run is observed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@rly
rly requested a review from oruebel September 16, 2026 04:55
@rly
rly marked this pull request as ready for review September 16, 2026 04:55
@oruebel
oruebel merged commit 65b394f into main Sep 20, 2026
6 checks passed
@oruebel
oruebel deleted the link-check-changed-files branch September 20, 2026 23:11
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.

2 participants