Skip to content

Use Lychee as a link check #411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions .github/workflows/check_links.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
name: Check Links
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: "0 5 * * *"
workflow_dispatch: # allows manual triggering of the workflow
jobs:
build:
check:
runs-on: ubuntu-latest
permissions:
issues: write # required for peter-evans/create-issue-from-file
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: python -m pip install -r requirements.txt
- name: Check broken links
run: sphinx-build -nW -b linkcheck . _build
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: python -m pip install -r requirements.txt
- name: Build documentation
run: sphinx-build -nWaE . _build
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
args: _build
fail: false
- name: Create Issue From File
if: steps.lychee.outputs.exit_code != 0
uses: peter-evans/create-issue-from-file@v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: broken links
6 changes: 4 additions & 2 deletions .github/workflows/build.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build
name: Test
on:
push:
pull_request:
jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -15,3 +15,5 @@ jobs:
run: python -m pip install -r requirements.txt
- name: Test
run: pytest
- name: Build documentation
run: sphinx-build -nWaE . _build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,6 @@ venv.bak/

# scripts/lint_requirements.sh
*-requirements.txt

# Lychee
.lycheecache
15 changes: 13 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,23 @@ Continuous Integration

Na repozitáři jsou zapojeny `GitHub Actions <https://github.com/pyvec/docs.pyvec.org/actions>`_. Kontrolka:

.. image:: https://github.com/pyvec/docs.pyvec.org/actions/workflows/build.yml/badge.svg
.. image:: https://github.com/pyvec/docs.pyvec.org/actions/workflows/test.yml/badge.svg
:target: https://github.com/pyvec/docs.pyvec.org/actions
:alt: Continuous Integration Status
:alt: Continuous Integration Status (test)

CI je pouze informativní a nezabrání tomu, aby se hlavní větev dostala do ReadTheDocs.

Kontrola rozbitých odkazů
-------------------------

Na repozitáři je zapojená `GitHub Action <https://github.com/lycheeverse/lychee-action>`_, která jednou denně kontroluje, zda všechny odkazy fungují. Kontrolka:

.. image:: https://github.com/pyvec/docs.pyvec.org/actions/workflows/check_links.yml/badge.svg
:target: https://github.com/pyvec/docs.pyvec.org/actions
:alt: Continuous Integration Status (check links)

Dokonce by to mělo automaticky zakládat i issue, pokud to najde nějaký problém. V případě, že je potřeba ignorovat nějakou doménu nebo konkrétní odkaz, je možné to udělat v souboru `lychee.toml`.

.. _generate_grants:

Skript na generování zápisů hlasování o grantech
Expand Down
2 changes: 1 addition & 1 deletion guides/meetup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ Materiály z přednášek

Jako archiv informací o jednotlivých srazech jsme využívali `Lanyrd <https://en.wikipedia.org/wiki/Lanyrd>`__, ale nakonec jsme si na `pyvo.cz <https://pyvo.cz/>`__ udělali vlastní systém s databází `pyvo-data <https://github.com/pyvec/pyvo-data>`__.

Pokud máš nějaké slajdy nebo jiné materiály, je dobré je na stránky vašeho srazu doplnit k popisu přednášek. Může to být skoro cokoliv od odkazu na YouTube s videem z přednášky, po odkazy na slajdy ze služeb jako `Speaker Deck <https://speakerdeck.com/>`__ či `SlideShare <https://www.slideshare.net/>`__. Pokud ti přednášející předá slajdy ve formě souboru, převeď je pokud možno na PDF a nahraj do repozitáře `talks-archive <https://github.com/pyvec/talks-archive>`__. Následně na ně odkazuj ve formátu ``https://pyvec.github.io/talks-archive/<název souboru>``
Pokud máš nějaké slajdy nebo jiné materiály, je dobré je na stránky vašeho srazu doplnit k popisu přednášek. Může to být skoro cokoliv od odkazu na YouTube s videem z přednášky, po odkazy na slajdy ze služeb jako `Speaker Deck <https://speakerdeck.com/>`__ či `SlideShare <https://www.slideshare.net/>`__. Pokud ti přednášející předá slajdy ve formě souboru, převeď je pokud možno na PDF a nahraj do repozitáře `talks-archive <https://github.com/pyvec/talks-archive>`__.


.. _srazy-fotky:
Expand Down
36 changes: 36 additions & 0 deletions lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Interface
verbose = "info"
no_progress = true
cache = true
max_cache_age = "10m"

# Stealth
user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:138.0) Gecko/20100101 Firefox/138.0"

# Prevent 'Too Many Open Files'
max_concurrency = 32

# Check links inside `<code>` and `<pre>` blocks and Markdown code blocks
include_verbatim = true

# Check fragments in links
include_fragments = true

# Add 'Too many requests'
accept = ["100..=103", "200..=299", "429"]

# Be benevolent
max_retries = 5
timeout = 40

# Exclude
exclude = [
"127.0.0.1:8000",
"cz.pycon.org/20XX",

# Anti-scraping protections
"docs.google.com",
"www.facebook.com",
"www.nytimes.com",
"accounts.google.com",
]