link-checker #438
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
name: link-checker | |
on: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 0 * * SUN' # Sunday “At 00:30” | |
jobs: | |
link-checker: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
if: github.repository == 'brian-rose/ClimateLaboratoryBook' | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v4 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: book-render | |
use-mamba: true | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: /usr/share/miniconda3/envs/book-render | |
key: linux-64-conda-${{ hashFiles('render-environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: mamba env update -n book-render -f render-environment.yml | |
# - name: Disable notebook execution | |
# shell: python | |
# run: | | |
# import yaml | |
# with open('_config.yml') as f: | |
# data = yaml.safe_load(f) | |
# data['execute']['execute_notebooks'] = 'off' | |
# with open('_config.yml', 'w') as f: | |
# yaml.dump(data, f) | |
- name: Check external links | |
run: | | |
jupyter-book build --builder linkcheck . |