diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index ed04d53..4a8387d 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -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." diff --git a/changelog.d/20260812_issue_54_archived_broken_links.md b/changelog.d/20260812_issue_54_archived_broken_links.md new file mode 100644 index 0000000..6f314b4 --- /dev/null +++ b/changelog.d/20260812_issue_54_archived_broken_links.md @@ -0,0 +1,3 @@ +### Fixed + +- Fail broken-link validation for dead live URLs even when Web Archive snapshots are available. diff --git a/tests/test_workflows.py b/tests/test_workflows.py index 3365f2f..069379f 100644 --- a/tests/test_workflows.py +++ b/tests/test_workflows.py @@ -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 @@ -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