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

Broken Link Checker - Github Action #1572

Open
JuanPabloDiaz opened this issue May 9, 2024 · 1 comment
Open

Broken Link Checker - Github Action #1572

JuanPabloDiaz opened this issue May 9, 2024 · 1 comment

Comments

@JuanPabloDiaz
Copy link

I believe that it will be a great idea to setup a GitHub action that runs periodically and checks for broken links.
It will check all repository links once per day and create an issue in case of errors.

Github action to check for broken links in Markdown, HTML, and text files using Lychee, a fast link checker written in Rust.

Here is a full example of a GitHub workflow file:

It will check all repository links once per day and create an issue in case of errors.

name: Links

on:
  repository_dispatch:
  workflow_dispatch:
  schedule:
    - cron: "00 18 * * *"

jobs:
  linkChecker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Link Checker
        id: lychee
        uses: lycheeverse/lychee-action@v1

      - name: Create Issue From File
        if: env.lychee_exit_code != 0
        uses: peter-evans/create-issue-from-file@v4
        with:
          title: Link Checker Report
          content-filepath: ./lychee/out.md
          labels: report, automated issue

I'd like to share my experience with Lychee. I came across it yesterday and integrated it into my project. While it was helpful in identifying some broken links, it also generated some false positives (links that appear broken but function correctly). I'm still exploring the tool's functionality to potentially fine-tune its accuracy.

On a separate note, I encountered a permissions issue when trying to open new issues.

Project implementations:

here is an example from my own project:
image

I hope this helps

JuanPabloDiaz added a commit to JuanPabloDiaz/freeStuffDev that referenced this issue Jul 6, 2024
JuanPabloDiaz added a commit to JuanPabloDiaz/freeStuffDev that referenced this issue Jul 6, 2024
@JuanPabloDiaz
Copy link
Author

After running the workflow, it found 182 broken links, How do you want to handle this @hilmanski?

image

In my opinion, we will need to check that list and add all the "False Positive URLs" to the .lycheeignore file to ignore them

After running the workflow, this issue was created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant