Skip to content

Commit

Permalink
Add linkcheck step to be run once a week
Browse files Browse the repository at this point in the history
Can also be triggered manually. It creates an issue when broken links are found in the documentation, including docstrings.
  • Loading branch information
melissawm committed Aug 9, 2024
1 parent b979d31 commit e487a04
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: External links checker

on:
repository_dispatch:
workflow_dispatch: # can also be triggered manually
schedule:
- cron: "0 0 * * *" # every sunday at midnight

jobs:
link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Clone docs repo
uses: actions/checkout@v4
with:
# place in '/home/runner/work/docs/docs/docs'
path: docs # place in a named directory

- name: Clone main repo
uses: actions/checkout@v4
with:
# place in '/home/runner/work/docs/docs/napari'
path: napari # place in a named directory
repository: napari/napari
# ensure version metadata is proper
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache-dependency-path: |
napari/pyproject.toml
docs/requirements.txt
- uses: tlambert03/setup-qt-libs@v1

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "napari/[all]"
env:
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.10_docs.txt

- name: Run link checker
uses: aganders3/headless-gui@v2
env:
GOOGLE_CALENDAR_ID: ${{ secrets.GOOGLE_CALENDAR_ID }}
GOOGLE_CALENDAR_API_KEY: ${{ secrets.GOOGLE_CALENDAR_API_KEY }}
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.10_docs.txt
with:
# Runs in '/home/runner/work/docs/docs/docs'
# Built HTML pages in '/home/runner/work/docs/docs/docs/docs/_build/html'
run: |
python -m pip install -r docs/requirements.txt
make -C docs linkcheck-files
# skipping setup stops the action from running the default (tiling) window manager
# the window manager is not necessary for docs builds at this time and it was causing
# problems with screenshots (https://github.com/napari/docs/issues/285)
linux-setup: "echo 'skip setup'"
linux-teardown: "echo 'skip teardown'"

- name: Create issue from file
if: ${{ failure() }}
uses: peter-evans/create-issue-from-file@v4
with:
title: Link Checker Report
content-filepath: ./docs/docs/_build/html/output.txt
labels: maintenance, task

0 comments on commit e487a04

Please sign in to comment.