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

Add Broken Link CI #664

Open
naher94 opened this issue Feb 17, 2024 · 3 comments
Open

Add Broken Link CI #664

naher94 opened this issue Feb 17, 2024 · 3 comments
Labels

Comments

@naher94
Copy link
Owner

naher94 commented Feb 17, 2024

Create a GitHub action that runs on a regular cadence scanning for dead links and prompts me so that I can fix them

Future Updates

@naher94 naher94 added the CI/CD label Feb 17, 2024
@naher94

This comment has been minimized.

@naher94 naher94 changed the title Verify that Broken Link CI Works Add Broken Link CI Mar 3, 2024
@naher94

This comment has been minimized.

@naher94
Copy link
Owner Author

naher94 commented Mar 2, 2025

This works but check the whole repo not just the _site directory

name: Link Checker

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

jobs:
  linkChecker:
    runs-on: ubuntu-latest
    permissions:
      issues: write # required for peter-evans/create-issue-from-file
    steps:
      - name: Checkout gh-pages branch
        uses: actions/checkout@v4
        with:
          ref: gh-pages

      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.0.0

      - name: Install Dependencies
        run: |
          gem install bundler
          bundle install

      - name: Build Jekyll site
        run: bundle exec jekyll build --trace

      - name: Filter files to check (include _site, exclude _site/css and _site/img)
        run: |
          # Find all files in _site, but exclude _site/css and _site/img
          find ./_site -type f | grep -vE '/(css|img)/' > files-to-check.txt
          cat files-to-check.txt

      - name: Link Checker
        id: lychee
        uses: lycheeverse/lychee-action@v2
        with:
          fail: false
          files: './files-to-check.txt'
          base: https://rehanbutt.com

      - name: Create Issue From File
        if: steps.lychee.outputs.exit_code != 0
        uses: peter-evans/create-issue-from-file@v5
        with:
          title: Dead Links Found - Link Checker Report
          content-filepath: ./lychee/out.md

naher94 added a commit that referenced this issue Mar 7, 2025
exclude linkedin #664
naher94 added a commit that referenced this issue Mar 7, 2025
relates to #664
excludes linkedin and codepen urls
naher94 added a commit that referenced this issue Mar 7, 2025
naher94 added a commit that referenced this issue Mar 7, 2025
naher94 added a commit that referenced this issue Mar 7, 2025
naher94 added a commit that referenced this issue Mar 7, 2025
@naher94 naher94 mentioned this issue Mar 7, 2025
naher94 added a commit that referenced this issue Mar 7, 2025
naher94 added a commit that referenced this issue Mar 7, 2025
naher94 added a commit that referenced this issue Mar 7, 2025
@naher94 naher94 mentioned this issue Mar 7, 2025
naher94 added a commit that referenced this issue Mar 7, 2025
threads link excluded
#664
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant