Skip to content

Commit 1e08352

Browse files
committed
Per METplus#3247, adding automated link checking in conjunction with new repo dtcenter/metplus-action-linkcheck
1 parent 47f0069 commit 1e08352

3 files changed

Lines changed: 53 additions & 1 deletion

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: linkcheck-pr
2+
on:
3+
pull_request:
4+
paths:
5+
- 'docs/**'
6+
7+
jobs:
8+
linkcheck:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: dtcenter/metplus-action-linkcheck@v1
13+
with:
14+
fail-on-broken-links: 'true'
15+
upload-artifact: 'true'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: linkcheck-scheduled
2+
on:
3+
schedule:
4+
- cron: '0 6 * * 1'
5+
workflow_dispatch: {}
6+
7+
jobs:
8+
linkcheck:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: dtcenter/metplus-action-linkcheck@v1
13+
with:
14+
fail-on-broken-links: 'true'
15+

docs/conf.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,29 @@
9797
numfig_format = {
9898
'figure': 'Figure %s',
9999
}
100-
100+
101+
# -- linkcheck builder configuration ----------------------------------
102+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder
103+
104+
linkcheck_timeout = 10
105+
linkcheck_retries = 2
106+
linkcheck_workers = 8
107+
108+
linkcheck_ignore = [
109+
# add regex patterns for URLs that should be skipped, e.g.:
110+
# r'https://dtcenter\.org/.*', # if this site blocks automated requests
111+
# r'https://matplotlib\.org/.*', # occasionally rate-limits automated clients
112+
# r'https://scitools\.org\.uk/cartopy/.*', # occasionally slow
113+
# r'https://doi\.org/.*', # DOI redirectors often 403 non-browser requests
114+
]
115+
116+
linkcheck_allowed_redirects = {
117+
# map of regex -> regex for redirects that are fine to follow
118+
}
119+
120+
linkcheck_anchors = True
121+
linkcheck_anchors_ignore = ['^!']
122+
101123
# -- Export variables --------------------------------------------------------
102124

103125
rst_epilog = """

0 commit comments

Comments
 (0)