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 #354

Closed
JuanPabloDiaz opened this issue May 9, 2024 · 8 comments · Fixed by #391
Closed

Broken Link Checker - Github Action #354

JuanPabloDiaz opened this issue May 9, 2024 · 8 comments · Fixed by #391

Comments

@JuanPabloDiaz
Copy link
Collaborator

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
Copy link
Collaborator Author

My bad, I believe you are already using a github action that does just that. Could you please confirm if validate_links.yml check for broken links?

@marcelscruz
Copy link
Owner

The file you linked came from the original fork, and as we changed a few things around here, I'm not sure if it's working.
If you have a good understanding of Python (which I don't), it'd be great if you could have a look at it and see if it's still working! 🙏
Btw, you summary screenshot looks great, would love like that around here!

JuanPabloDiaz added a commit to JuanPabloDiaz/public-api that referenced this issue Jul 5, 2024
@JuanPabloDiaz
Copy link
Collaborator Author

JuanPabloDiaz commented Jul 5, 2024

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

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

JuanPabloDiaz added a commit to JuanPabloDiaz/public-api that referenced this issue Jul 5, 2024
@marcelscruz
Copy link
Owner

URLs added to .lycheeignore will be skipped by the script, is that it?
If so, I think that's a good way to get started.
We can manually delete the broken ones and add the false positives to this file.
If it becomes cumbersome at some point we can try to automate these tasks.
What do you think?

@JuanPabloDiaz
Copy link
Collaborator Author

URLs added to .lycheeignore will be skipped by the script, is that it?

yes

What do you think?

Sounds good to me

@marcelscruz
Copy link
Owner

Awesome, feel free to open a PR with whatever you have and I'll jump in asap.

JuanPabloDiaz added a commit to JuanPabloDiaz/public-api that referenced this issue Jul 12, 2024
JuanPabloDiaz added a commit to JuanPabloDiaz/public-api that referenced this issue Jul 12, 2024
@JuanPabloDiaz
Copy link
Collaborator Author

JuanPabloDiaz commented Jul 12, 2024

  1. this site needs credentials, Should I delete it?

| AdoptAPet | Resource to help get pets adopted | apiKey | Yes | Yes |

  1. Site Down but check this issue

| Bored | Find random activities to fight boredom | No | Yes | Unknown |

JuanPabloDiaz added a commit to JuanPabloDiaz/public-api that referenced this issue Jul 12, 2024
JuanPabloDiaz added a commit to JuanPabloDiaz/public-api that referenced this issue Jul 12, 2024
JuanPabloDiaz added a commit to JuanPabloDiaz/public-api that referenced this issue Jul 12, 2024
JuanPabloDiaz added a commit to JuanPabloDiaz/public-api that referenced this issue Jul 12, 2024
Fixes marcelscruz#354
- Add Workflow
- Add ignore file
- Add false positive urls to ignore file
- Fix URL in readme
- Delete broken links in readme
- run tests
@JuanPabloDiaz
Copy link
Collaborator Author

Awesome, feel free to open a PR with whatever you have and I'll jump in asap.

I put together a PR with all the changes in one commit.

It run the test, but it did not create an issue with the RESULTS.

marcelscruz pushed a commit that referenced this issue Jul 23, 2024
Broken links checker workflow
Fixes #354
- Add Workflow
- Add ignore file
- Add false positive urls to ignore file
- Fix URL in readme
- Delete broken links in readme
- run tests
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

Successfully merging a pull request may close this issue.

2 participants