name: Link checks

on:
  # Run manually by clicking a button in the UI
  workflow_dispatch:
  # Run once a day at 8:00am UTC
  schedule:
    - cron: '0 8 * * *'

env:
  CONDA_ENV: test-env
  GITHUB_ACTIONS: 'true'
  OS_NAME: 'linux'
  PYTHON_VERSION: '3.10'
  TASK: 'check-links'

jobs:
  check-links:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 5
          submodules: false
      - name: Setup and run tests
        run: |
          export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
          export CONDA=${HOME}/miniforge
          export PATH=${CONDA}/bin:${HOME}/.local/bin:${PATH}
          $GITHUB_WORKSPACE/.ci/setup.sh || exit -1
          $GITHUB_WORKSPACE/.ci/test.sh || exit -1
