-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[build] Fix for detecting stale http links. #4740
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
Open
kaby76
wants to merge
16
commits into
antlr:master
Choose a base branch
from
kaby76:g4-4734
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+682
−2
Conversation
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
Adds a script to detect and optionally replace stale HTTP links with web.archive.org archived versions. The script uses git blame to find when each link was added, then queries the Wayback Machine API for an archive closest to that date. Also adds a GitHub Actions workflow that runs weekly to check for stale links, creates issues when found, and can create PRs with fixes when triggered manually. Fixes antlr#4734 Co-Authored-By: Claude Opus 4.5 <[email protected]>
Handle URLs containing parentheses (e.g., Wikipedia links) by balancing parens after extraction instead of excluding ) from the match pattern. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Handle URLs in BibTeX files where closing } was being included in the URL. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Example files are parse test cases, not documentation. Skip them to avoid false positives from old example content. Keep checking .md files as they may contain documentation with links worth validating. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add : to trailing punctuation cleanup to handle markdown like [text](url): This fixes the paren balancing for URLs followed by colons - Expand example directory matching to catch variations like examples/, example/, examples-to-fix/, examples.errors/, etc. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
Author
|
99 stale links detected: |
- Add find-stale-link-grammars.sh script that checks only grammars changed between two git refs - Add stale-links job to main.yml workflow to run on PRs - Remove weekly stale-links.yml workflow (now done per-PR) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Some legitimate URLs like gnu.org can take up to 20 seconds to respond. Increase the default timeout from 10s to 30s to be more forgiving. Co-Authored-By: Claude Opus 4.5 <[email protected]>
bash ../_scripts/find-stale-links.sh --replace
Contributor
Author
|
Still getting timeouts with 30s wait on http links. May need to run the downloads in parallel so that it doesn't take too long with many links, and bump up to 1 minute wait. |
- Default timeout increased from 30s to 60s for slow CI environments - Added --parallel N option (default: 10) for concurrent URL checks - Restructured into 3 phases: collect URLs, check in parallel, process results Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Timeouts (HTTP 000) are now reported separately as warnings - Only actual HTTP errors (404, 500, etc.) cause build failure - Show HTTP status codes in reports for better debugging Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.
This is a fix for #4734. I had Claude write a Bash script that detects stale links. The check is done per PR, per grammar, and is also done weekly. The script is _scripts/find-stale-links.sh and includes the
--replaceoption, which modifies stale links and replaces them with web.archive.org links.