Repository navigation
Check newly introduced external FAQ links before publishing - #68
Draft
lyzhang0113 wants to merge 1 commit into
Draft
lyzhang0113 wants to merge 1 commit into
lyzhang0113 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Valid Markdown URLs containing balanced parentheses are truncated and checked incorrectly.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds CI enforcement for newly introduced broken external FAQ links while allowing inconclusive responses as warnings.
Changes:
- Rewrites the external-link checker with TLS verification and base-revision comparison.
- Adds tests, CI gating, and contributor documentation.
- Excludes generated Python cache files.
| File | Description |
|---|---|
check_links.py |
Implements external-link discovery and validation. |
tests/test_check_links.py |
Tests scanning and changed-link behavior. |
.github/workflows/main.yml |
Adds link-check CI gating. |
README.md |
Documents link-check behavior. |
.gitignore |
Ignores Python cache directories. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| ROOT = Path(__file__).resolve().parent | ||
| PUBLISHED_ROOTS = {"barcode-reader", "mrz-scanner", "license"} | ||
| MARKDOWN_LINK = re.compile(r"!?\[[^\]\n]*\]\(\s*<?(https?://[^\s)>]+)", re.I) |
Comment on lines
+94
to
+98
| with urlopen(request, timeout=15) as response: # default verified TLS context | ||
| final_host = urlsplit(response.url).hostname or "" | ||
| if final_host == "dynamsoft.com" or final_host.endswith(".dynamsoft.com"): | ||
| body = response.read(50000).decode("utf-8", errors="replace").lower() | ||
| if (re.search(r'id=["\']pagenotfound["\']', body) or |
lyzhang0113
marked this pull request as draft
September 30, 2026 07:39
Contributor
Author
|
There are existing broken links. Fix them before merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Changes
check_links.pyto scan published FAQ Markdown only, verify HTTPS certificates, distinguish confirmed broken URLs from inconclusive remote responses, and fail on confirmed breakage.Check-Linksjob for PRs and pushes tomain/preview; build/sync jobs depend on its success. Add behavior tests and contributor documentation.Verification
python -B -m unittest discover -s tests -v— 2 passed.python -B check_links.py --base-ref origin/preview— 0 newly introduced URLs, exit 0.python check_links.py— found 2 pre-existing GitHub 404s inbarcode-reader/mobile/scan-setting/disable-continuous-scanning.mdand 2 inconclusive npm 403s inbarcode-reader/web/configuration/nodejs-implementation.md(exit 1); these pages are untouched.Note: inconclusive network/access errors remain warnings, not publish-blocking failures; relative links and anchors are outside this external-link check.