priyankarpal / projectshut

Projectshut is an open source web app that enables users to freely publish their projects and create user profiles within the platform āœØšŸš€
https://www.projectshut.tech
MIT License
397 stars 492 forks source link

feat: Broken Link Checker - Github Action #2505

Closed JuanPabloDiaz closed 2 months ago

JuanPabloDiaz commented 2 months ago

What feature?

I believe that it will be a great idea to setup a GitHub action that runs periodically and checks for broken links.

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.

I hope this helps

Add screenshots

here is an example from my own project: image

Record

github-actions[bot] commented 2 months ago

To reduce notifications, issues are locked. Your issue will be unlock when we will add label as šŸ status: ready for dev. Check out the contributing guide for more information.

priyankarpal commented 2 months ago

sure assigned