Skip to content

Commit 5d2b34f

Browse files
authored
Add a workflow checking links in plaintext and HTML files (#634)
This PR adds a workflow to check external links in plaintext and HTML files, using action lycheeverse/lychee-action. - External links in the ReST, Markdown and Python files in the master branch are checked - External links in the dev documentation (pygmt.org/dev) are checked - Internal links are NOT checked, but when we build the documentation, we should see the warnings if internal links are broken. - Links to PRs and issues are excluded, because they are unlikely to be broken The workflow runs weekly. If broken links (404) are detected, it will report an issue (see #927 for an example, in which I added a broken link pygmt.org/abc/def for testing).
1 parent c91f7c3 commit 5d2b34f

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/check-links.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This workflow checks the links in plaintext and HTML files
2+
name: Check Links
3+
4+
on:
5+
# Uncomment the 'pull_request' line below to trigger the workflow in PR
6+
# pull_request:
7+
# Schedule runs on 12 noon every Sunday
8+
schedule:
9+
- cron: '0 12 * * 0'
10+
11+
jobs:
12+
check_links:
13+
name: Check Links
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout the repository
18+
uses: actions/[email protected]
19+
with:
20+
path: repository
21+
22+
- name: Checkout the documentation
23+
uses: actions/[email protected]
24+
with:
25+
ref: gh-pages
26+
path: documentation
27+
28+
- name: Link Checker
29+
uses: lycheeverse/[email protected]
30+
with:
31+
# 429: Too many requests
32+
args: >
33+
--accept 429
34+
--exclude "^https://zenodo.org/badge/DOI/$"
35+
--exclude "^https://github.com/GenericMappingTools/pygmt/pull/[0-9]*$"
36+
--exclude "^https://github.com/GenericMappingTools/pygmt/issues/[0-9]*$"
37+
--exclude "^https://www.generic-mapping-tools.org/_static/gmt-logo.png/$"
38+
--exclude "^https://www.generic-mapping-tools.org/_static/gmt-logo.png/n/n$"
39+
--exclude "^``@ridge.txt$"
40+
--exclude "^git"
41+
--exclude "^file://"
42+
--exclude "^https://docs.generic-mapping-tools.org/latest/%s$"
43+
--verbose
44+
"repository/**/*.rst"
45+
"repository/**/*.md"
46+
"repository/**/*.py"
47+
"documentation/dev/**/*.html"
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Create Issue From File
52+
uses: peter-evans/[email protected]
53+
with:
54+
title: Link Checker Report
55+
content-filepath: ./lychee/out.md

0 commit comments

Comments
 (0)