-
Notifications
You must be signed in to change notification settings - Fork 9
ci: Add script &CI to check dead links #45
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
liugddx
wants to merge
17
commits into
eclipse-edc:main
Choose a base branch
from
liugddx:ci-1
base: main
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
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
90b83b3
fix dead links
liugddx 3225cf3
fix dead links
liugddx 9d2cf21
fix dead links
liugddx dd4139c
fix dead links
liugddx 964260d
fix dead links
liugddx a035d2a
fix dead links
liugddx 8539dde
fix dead links
liugddx 8f904d5
Update exclude_patterns.txt
liugddx a6fbaed
Improve broken link checking workflow
liugddx 4c833f6
Update link checking workflow and remove README changes
liugddx ec114ff
Remove obsolete exclude_patterns.txt
liugddx 5e3a74d
Fix local file link checking issues
liugddx 6228070
Add alternative markdown-link-check workflow
liugddx 822a02d
Remove alternative workflow and optimize GitHub API rate limits
liugddx bd3aa05
Fix Hugo rendering issues in link checking
liugddx 8c44ee4
Simplify link checking to focus on external URLs only
liugddx 0eb8fac
Improve broken link detection workflows
liugddx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Scheduled Broken Links Check | ||
|
||
on: | ||
# Run on schedule | ||
schedule: | ||
- cron: "0 0 * * 0" # Runs at 00:00 UTC every Sunday | ||
# Manual trigger | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check-links: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
issues: write # Permission needed to create issues | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Optional: Cache to reduce API rate limits and duplicate requests | ||
- name: Restore lychee cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: .lycheecache | ||
key: cache-lychee-${{ github.sha }} | ||
restore-keys: cache-lychee- | ||
|
||
- name: Link Checker | ||
id: lychee | ||
uses: lycheeverse/lychee-action@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
args: >- | ||
--cache | ||
--max-cache-age 48h | ||
--verbose | ||
--no-progress | ||
--exclude-path ".git" | ||
--exclude-path "node_modules" | ||
--max-retries 5 | ||
--timeout 30 | ||
--max-concurrency 8 | ||
--retry-wait-time 3 | ||
'./**/*.md' | ||
'./**/*.html' | ||
'./**/*.txt' | ||
fail: false | ||
format: markdown | ||
|
||
- name: Create Issue From File | ||
if: steps.lychee.outputs.exit_code != 0 | ||
uses: peter-evans/create-issue-from-file@v5 | ||
with: | ||
title: 🔍 Broken Links Report | ||
content-filepath: ./lychee/out.md | ||
labels: bug, documentation |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to keep two different workflows? they do pretty much the same thing, let's refactor them |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Check Broken Links | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
# Optional: Add scheduled checks | ||
# schedule: | ||
# - cron: "0 0 * * 0" # Runs once every Sunday | ||
|
||
jobs: | ||
check-links: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Set up caching to reduce API requests | ||
- name: Restore lychee cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: .lycheecache | ||
key: cache-lychee-${{ github.sha }} | ||
restore-keys: cache-lychee- | ||
|
||
- name: Setup link exclusion patterns (optional) | ||
id: setup-exclude | ||
run: | | ||
if [ -f .lycheeignore ]; then | ||
echo "Exclusion patterns found in .lycheeignore" | ||
else | ||
echo "# Add URL regex patterns to exclude, one per line" > .lycheeignore | ||
echo "# Example: ^https://example.com" >> .lycheeignore | ||
fi | ||
|
||
- name: Link Checker | ||
id: lychee | ||
uses: lycheeverse/lychee-action@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
args: >- | ||
--cache | ||
--max-cache-age 48h | ||
--verbose | ||
--no-progress | ||
--exclude-path ".git" | ||
--exclude-path "node_modules" | ||
--max-retries 5 | ||
--timeout 30 | ||
--max-concurrency 8 | ||
--retry-wait-time 3 | ||
'./**/*.md' | ||
'./**/*.html' | ||
'./**/*.txt' | ||
fail: true | ||
format: markdown | ||
output: ./lychee-report.md | ||
|
||
# If you want to post check results as PR comments, uncomment the following step | ||
# - name: Create Comment | ||
# uses: peter-evans/create-or-update-comment@v3 | ||
# if: github.event_name == 'pull_request' && steps.lychee.outputs.exit_code != 0 | ||
# with: | ||
# issue-number: ${{ github.event.pull_request.number }} | ||
# body-file: ./lychee-report.md |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# URL patterns to exclude from checking, one regex pattern per line | ||
# These links will be ignored by lychee | ||
|
||
# Example domains | ||
^https?://example\.com | ||
^https?://example\.org | ||
|
||
# Common temporary URLs or local development URLs | ||
^https?://localhost | ||
^https?://127\.0\.0\.1 | ||
^https?://0\.0\.0\.0 | ||
|
||
# Social media links (often have anti-scraping measures that may cause checks to fail) | ||
^https?://(www\.)?linkedin\.com | ||
^https?://(www\.)?twitter\.com | ||
^https?://(www\.)?facebook\.com | ||
|
||
# Files that may have restricted access | ||
\.pdf$ | ||
|
||
# Local file paths that exist in production but not in CI environment | ||
file:///home/runner/work/eclipse-edc.github.io/eclipse-edc.github.io/content/en/images/edc.schematic.svg | ||
# Exclude all local SVG files as they may be processed during build | ||
file://.*\.svg$ | ||
# Exclude content directory files which may be generated during build | ||
file://.*?/content/.* | ||
|
||
# GitHub specific patterns to reduce API rate limiting | ||
# These patterns are specifically for repositories that frequently cause 429 errors | ||
^https?://github\.com/git/git/blob/ | ||
^https?://raw\.githubusercontent\.com/git/ | ||
^https?://api\.github\.com/ | ||
|
||
# Add project-specific URL patterns to exclude here |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove obvious comments