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

New GitHub Action - Check Broken Links #391

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/broken-link-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This workflow uses the lychee-action to check the links
# in your markdown files for validity.
# You can exclude links via a .lycheeignore file in your repository root.
# You find further information about lychee-action in the documentation at:
# https://github.com/lycheeverse/lychee-action

name: Check for broken links

on:
pull_request:
branches:
- main
workflow_dispatch:
schedule: # Run every weekday at 12:30 UTC
- cron: "30 12 * * 1-5"

jobs:
Check-for-broken-links:
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'
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
34 changes: 34 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!-- This is a list of URLs that Lychee should ignore. -->
<!-- False Positive URL -->

https://www.velib-metropole.fr/donnees-open-data-gbfs-du-service-velib-metropole
https://www.damsuccess.com/hc/en-us/articles/202134055-REST-API
https://www.hackerearth.com/docs/wiki/developers/v4
https://www.digikey.com/en/resources/api-solutions
http://geodb-cities-api.wirefreethought.com
https://www.udemy.com/developers/instructor
https://cheetaho.com/docs/getting-started
https://collection.cooperhewitt.org/api
https://www.infura.io/product/ethereum
https://www.ups.com/upsdeveloperkit
https://securitytrails.com/corp/api
https://developer.uber.com/products
https://www.discogs.com/developers
https://opendata.city-adm.lviv.ua
https://developers.printful.com
https://www.fbi.gov/wanted/api
https://www.saidit.net/dev/api
https://developers.upwork.com
https://jooble.org/api/about
https://search.censys.io/api
https://developers.bb.com.br
https://api.squiggle.com.au
https://www.pexels.com/api
https://www.linguarobot.io
https://api-docs.igdb.com
https://www.geoplugin.com
https://www.zenrows.com
https://www.dati.gov.it
https://docs.genius.com
https://data.gov.sa/ar
https://data.gov.cy
Loading
Loading