diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml new file mode 100644 index 00000000..305c6dce --- /dev/null +++ b/.github/workflows/linkcheck.yml @@ -0,0 +1,19 @@ +name: Linkcheck +on: + schedule: + - cron: '0 6 * * 1' + pull_request: + paths: + - 'docs/**' + workflow_dispatch: {} + +jobs: + linkcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: dtcenter/metplus-action-linkcheck@v1 + with: + fail-on-broken-links: 'true' + upload-artifact: 'true' + install-package: 'true' \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 3da31ba3..fde51216 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -97,7 +97,29 @@ numfig_format = { 'figure': 'Figure %s', } - + +# -- linkcheck builder configuration ---------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder + +linkcheck_timeout = 10 +linkcheck_retries = 2 +linkcheck_workers = 8 + +linkcheck_ignore = [ + # add regex patterns for URLs that should be skipped, e.g.: + # r'https://dtcenter\.org/.*', # if this site blocks automated requests + # r'https://matplotlib\.org/.*', # occasionally rate-limits automated clients + # r'https://scitools\.org\.uk/cartopy/.*', # occasionally slow + # r'https://doi\.org/.*', # DOI redirectors often 403 non-browser requests +] + +linkcheck_allowed_redirects = { + # map of regex -> regex for redirects that are fine to follow +} + +linkcheck_anchors = True +linkcheck_anchors_ignore = ['^!'] + # -- Export variables -------------------------------------------------------- rst_epilog = """ @@ -110,3 +132,4 @@ release_datestr = release_date, release_yearstr = release_year) +