Skip to content
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

🌱 Change link checker to lychee #517

Merged
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
26 changes: 23 additions & 3 deletions .github/workflows/broken-link-check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"
repository_dispatch: # run manually
Expand All @@ -16,7 +17,26 @@ jobs:
contents: read
issues: write

if: github.repository == 'metal3-io/metal3-io.github.io'
steps:
- name: Broken Link Check
uses: technote-space/broken-link-checker-action@b8332d945b97f8b52eb8d7d889a1e0e37106c1a9 # v2.3.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Read URLs From Sitemap
id: extract
run: echo "urls=$(curl -sL https://metal3.io/sitemap.xml | grep -o "<loc>[^<]*" | sed -e 's/<[^>]*>//g' | tr '\n' ' ')" >> $GITHUB_OUTPUT

- name: Link Checker Metal3.io Web Page
id: lycheemetal3io
uses: lycheeverse/lychee-action@f81112d0d2814ded911bd23e3beaa9dda9093915 # v2.1.0
with:
args: --user-agent "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" ${{ steps.extract.outputs.urls }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love how the user-agent is some 15 year old build of Firefox ;)

output: /tmp/lychee_output.md
fail: false

- name: Create Issue From File Metal3.io
if: steps.lycheemetal3io.outputs.exit_code != 0
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5.0.1
with:
title: Link Checker Report
content-filepath: /tmp/lychee_output.md
labels: |
kind/bug
5 changes: 5 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
https://localhost
http://localhost
https://0.0.0.0
http://0.0.0.0
https://github.com/issues
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ignore GH issues?

Copy link
Member

@tuminoid tuminoid Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scanner gets detected by github as bot, and gets 404. Bots should be using GH API for issue search.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual link failing is filtered query to metal3 issues, IIRC good first issues. Its not the base issue url that we technically ignore.

Loading