Skip to content

Commit

Permalink
feat: Broken Link Checker - Github Action
Browse files Browse the repository at this point in the history
Broken Link Checker - Github Action
  • Loading branch information
rupali-codes authored Jul 25, 2024
2 parents e06885c + 9faadb3 commit b7b963f
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/check_links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Check links

on:
pull_request:
branches:
- test
push:
branches:
- test
workflow_dispatch:
schedule:
- cron: '30 12 * * 1' # This will run every Monday at 12:30 UTC

jobs:
LinkChecker:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
env:
issue-lookup-label: automated-link-issue
issue-content: ./lychee-out.md
steps:
- uses: actions/checkout@v4
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
with:
fail: true
args: --verbose --no-progress --exclude-file .lycheeignore '**/*.md' '**/*.json'
output: ${{ env.issue-content }}

# Permissions (issues: read)
- name: 'Look for an existing issue'
if: ${{ failure() }}
id: last-issue
uses: micalevisk/last-issue-action@v2
# Find the last updated open issue with a `automated-issue` label:
with:
state: open
labels: ${{ env.issue-lookup-label }}

# Permissions (issues: write)
- name: 'Create a new issue, or update an existing one'
if: ${{ failure() }}
uses: peter-evans/create-issue-from-file@v4
with:
title: 'docs: Broken links found'
content-filepath: ${{ env.issue-content }}
# Update an existing issue if one was found (issue_number),
# otherwise an empty value creates a new issue:
issue-number: ${{ steps['last-issue']['outputs']['issue-number'] }}
# Add a label(s) that `last-issue` can use to find this issue,
# and any other relevant labels for the issue itself:
labels: |
${{ env.issue-lookup-label }}
broken-link, docs
19 changes: 19 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- This is a list of URLs that Lychee should ignore. -->
<!-- False Positive URL -->

https://canva.com/
https://leetcode.com/
https://www.udemy.com/
https://recharts.org/en-US/
https://pexels.com/
https://www.interviewbit.com/
https://codepen.io/
https://flaticon.com/
https://in.indeed.com/
https://pixabay.com/
https://www.phind.com
https://www.trellix.com/
https://www.brimble.io/
https://www.000webhost.com/
https://www.glassdoor.co.in/index.htm
https://www.gartner.com/reviews/market/security-information-event-management

0 comments on commit b7b963f

Please sign in to comment.