Check Links #199
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check links in plaintext files in the repository | |
# | |
# This workflow runs the lychee tool to check all links in plaintext files. It will | |
# create an issue if broken links are found. | |
# | |
# It is scheduled to run weekly at 12 noon every Sunday. | |
# | |
name: Check Links | |
on: | |
# Uncomment the 'pull_request' line below to trigger the workflow in PR | |
# pull_request: | |
workflow_dispatch: | |
# Schedule runs on 12 noon every Sunday | |
schedule: | |
- cron: '0 12 * * 0' | |
jobs: | |
check_links: | |
name: Check Links | |
runs-on: ubuntu-latest | |
if: github.repository == 'GenericMappingTools/gmt' | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4.2.0 | |
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/lychee-action@v2.0.2 | |
with: | |
# 429: Too many requests | |
args: > | |
--accept 429 | |
--exclude ^ftp:// | |
--exclude ^https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$ | |
--exclude ^https://download1.rpmfusion.org/free/el/rpmfusion-free-release-$ | |
--exclude ^http://maps.google.com/mapfiles/kml/$ | |
--exclude ^http://aa.usno.navy.mil/faq/docs/lawyers.php$ | |
--exclude ^uhttp://my.server.com/images$ | |
--exclude ^-W@weight.png$ | |
--exclude ^http://topex.ucsd.edu/marine_grav/mar_grav.html | |
--exclude ^https://topex.ucsd.edu/sandwell/ | |
--exclude ^http://topex.ucsd.edu | |
--exclude ^https://doi.org | |
--exclude ^https://www.researchgate.net/ | |
--exclude ^http://www.eumetsat.int | |
--exclude ^http://nsis.sourceforge.io | |
--exclude ^https://www.ethnologue.com | |
--exclude ^https://linux.die.net/man/3/printf | |
--exclude ^https://www.softpedia.com/get/Tweak/Registry-Tweak/EditPath.shtml | |
--verbose | |
**/*.rst | |
**/*.rst_ | |
**/*.md | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Create Issue From File | |
if: env.lychee_exit_code != 0 | |
run: | | |
title="Link Checker Report on ${{ steps.date.outputs.date }}" | |
gh issue create --title "$title" --body-file ./lychee/out.md | |
env: | |
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} |