-
Notifications
You must be signed in to change notification settings - Fork 219
75 lines (68 loc) · 2.46 KB
/
check-links.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 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:
# Schedule runs on 12 noon every Sunday
schedule:
- cron: '0 12 * * 0'
jobs:
check_links:
name: Check Links
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4.0.0
with:
path: repository
- name: Checkout the documentation
uses: actions/checkout@v4.0.0
with:
ref: gh-pages
path: documentation
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1.8.0
with:
# 429: Too many requests
args: >
--accept 429
--exclude-mail
--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 "^git"
--exclude "^file://"
--exclude "^https://docs.generic-mapping-tools.org/latest/%s$"
--exclude "^https://docs.generic-mapping-tools.org/latest/%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/project/"
--exclude "^https://test.pypi.org/simple/"
--exclude "^https://twitter.com/"
--verbose
"repository/**/*.rst"
"repository/**/*.md"
"repository/**/*.py"
"documentation/dev/**/*.html"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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
uses: peter-evans/create-issue-from-file@v4
with:
title: Link Checker Report on ${{ steps.date.outputs.date }}
content-filepath: ./lychee/out.md