Check Links #257
Workflow file for this run
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 the repository and documentation | |
# | |
# This workflow runs the lychee tool to check all external links in plaintext | |
# and HTML 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/pygmt' | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4.1.7 | |
with: | |
path: repository | |
- name: Checkout the documentation | |
uses: actions/checkout@v4.1.7 | |
with: | |
ref: gh-pages | |
path: documentation | |
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/lychee-action@v1.10.0 | |
with: | |
output: /tmp/lychee-out.md | |
# 429: Too many requests | |
args: > | |
--accept 429 | |
--exclude "^https://doi.org/10.5281/zenodo$" | |
--exclude "^https://zenodo.org/badge/DOI/$" | |
--exclude "^https://zenodo.org/badge/DOI/10.5281/zenodo$" | |
--exclude "^https://github.com/GenericMappingTools/pygmt/pull/[0-9]*$" | |
--exclude "^https://github.com/GenericMappingTools/pygmt/issues/[0-9]*$" | |
--exclude "^https://github.com/GenericMappingTools/gmt/releases/tag/X.Y.Z$" | |
--exclude "^https://github.com/GenericMappingTools/pygmt/edit" | |
--exclude "^https://github.com/GenericMappingTools/pygmt/issues/new" | |
--exclude "^https://github.com/GenericMappingTools/pygmt/releases/tag/\{\{path\}\}" | |
--exclude "^https://www.pygmt.org/\{\{path\}\}" | |
--exclude "^git" | |
--exclude "^file://" | |
--exclude "^https://www.adobe.com/jp/print/postscript/pdfs/PLRM.pdf" | |
--exclude "^https://docs.generic-mapping-tools.org/6.5/%s$" | |
--exclude "^https://docs.generic-mapping-tools.org/6.5/%3Cmodule-name%3E.html$" | |
--exclude "^https://www.generic-mapping-tools.org/remote-datasets/%s$" | |
--exclude "^https://hackmd.io/@pygmt" | |
--exclude "^https://doi.org" | |
--exclude "^https://www.researchgate.net/" | |
--exclude "^https://test.pypi.org/simple/" | |
--verbose | |
"repository/**/*.rst" | |
"repository/**/*.md" | |
"repository/**/*.py" | |
"documentation/dev/**/*.html" | |
- 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: | | |
cd repository/ | |
title="Link Checker Report on ${{ steps.date.outputs.date }}" | |
gh issue create --title "$title" --body-file /tmp/lychee-out.md | |
env: | |
GH_TOKEN: ${{ github.token }} |