Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ jobs:
env:
LYCHEE_OUTPUT: lychee/out.md

- name: Fail if broken links found and no web archive fallback
if: steps.lychee.outputs.exit_code != 0 && steps.webarchive.outputs.all_archived != 'true'
- name: Fail if broken links were found
if: always() && steps.lychee.outputs.exit_code != 0
run: |
echo "::error::Broken links were detected with no Web Archive fallback available."
echo "::error::Broken live links were detected."
echo ""
echo "What happened:"
echo " lychee found one or more broken links in the *.md and *.html files of this repository."
echo " The Web Archive check found no archived versions for some of them."
echo " An available Web Archive snapshot is a suggested replacement; it does not make the live link valid."
echo ""
echo "How to fix:"
echo " 1. Review the 'Check links with lychee' step above for the broken links."
Expand Down
3 changes: 3 additions & 0 deletions changelog.d/20260812_issue_54_archived_broken_links.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- Fail broken-link validation for dead live URLs even when Web Archive snapshots are available.
11 changes: 5 additions & 6 deletions tests/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,15 @@ def test_security_workflow_scans_code_actions_and_dependencies() -> None:
assert "comment-summary-in-pr: on-failure" in dependency_job


def test_links_workflow_checks_docs_with_web_archive_fallback() -> None:
"""Markdown and HTML changes must trigger the bounded broken-link check."""
def test_links_workflow_fails_for_every_broken_live_link() -> None:
"""Archived snapshots must not make broken live links pass validation."""
workflow = read_workflow("links.yml")
link_job = workflow_job_block(workflow, "link-checker")
lychee_step = workflow_step_block(link_job, "Check links with lychee")
archive_step = workflow_step_block(
link_job, "Check broken links against Web Archive"
)
failure_step = workflow_step_block(
link_job, "Fail if broken links found and no web archive fallback"
)
failure_step = workflow_step_block(link_job, "Fail if broken links were found")

assert "- '**.md'" in workflow
assert "- '**.html'" in workflow
Expand All @@ -161,7 +159,8 @@ def test_links_workflow_checks_docs_with_web_archive_fallback() -> None:
assert "output: lychee/out.md" in lychee_step
assert "if: steps.lychee.outputs.exit_code != 0" in archive_step
assert "python scripts/check_web_archive.py" in archive_step
assert "steps.webarchive.outputs.all_archived != 'true'" in failure_step
assert "if: always() && steps.lychee.outputs.exit_code != 0" in failure_step
assert "all_archived" not in failure_step
assert "exit 1" in failure_step


Expand Down
Loading