Check links #138
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: Check links | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '**/*.html' | |
- '**/*.ipynb' | |
- '**/*.md' | |
- '.github/workflows/check_links.yaml' | |
push: | |
branches: | |
- main | |
paths: | |
- '**/*.html' | |
- '**/*.ipynb' | |
- '**/*.md' | |
- '.github/workflows/check_links.yaml' | |
permissions: | |
contents: read | |
issues: write | |
env: | |
UV_SYSTEM_PYTHON: 1 | |
jobs: | |
check_links: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v3.2.0 | |
with: | |
enable-cache: true | |
cache-dependency-glob: '**/*requirements.txt' | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: '3.12' | |
cache: pip | |
- name: Install dependencies | |
run: | | |
uv pip install --upgrade pip setuptools wheel | |
uv pip install -r dev/requirements/check_links_requirements.txt | |
- name: Convert notebooks to markdown | |
run: | | |
find . -name "*.ipynb" -exec jupyter nbconvert --to markdown {} \; | |
- name: Check links with lychee | |
uses: lycheeverse/lychee-action@7cd0af4c74a61395d455af97419279d86aafaede # v2.0.2 | |
with: | |
args: | | |
--exclude .*\/maps\/.*\.html$ | |
--exclude-path docs/overrides/partials/copyright.html | |
--exclude-path docs/overrides/partials/logo.html | |
--user-agent curl | |
. | |
fail: |- | |
${{ github.event_name == 'pull_request' || github.event_name == 'push' }} | |
- name: Create issue | |
if: | | |
env.lychee_exit_code != 0 && | |
( | |
github.event_name == 'workflow_dispatch' || | |
github.event_name == 'schedule' | |
) | |
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5.0.1 | |
with: | |
title: 'Check links failed' | |
content-filepath: ./lychee/out.md | |
labels: | | |
docs | |
assignees: | | |
mrsmrynk |