Skip to content

Commit 1e2f54f

Browse files
authored
Merge pull request #411 from pyvec/honzajavorek/shiny-new-link-check
Use Lychee as a link check
2 parents 98b6ea7 + 603c650 commit 1e2f54f

File tree

6 files changed

+85
-16
lines changed

6 files changed

+85
-16
lines changed

.github/workflows/check_links.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
name: Check Links
22
on:
3+
repository_dispatch:
4+
workflow_dispatch:
35
schedule:
46
- cron: "0 5 * * *"
5-
workflow_dispatch: # allows manual triggering of the workflow
67
jobs:
7-
build:
8+
check:
89
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write # required for peter-evans/create-issue-from-file
912
steps:
10-
- uses: actions/checkout@v3
11-
- name: Set up Python
12-
uses: actions/setup-python@v4
13-
with:
14-
python-version: "3.12"
15-
- name: Install dependencies
16-
run: python -m pip install -r requirements.txt
17-
- name: Check broken links
18-
run: sphinx-build -nW -b linkcheck . _build
13+
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v3
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: "3.12"
19+
- name: Install dependencies
20+
run: python -m pip install -r requirements.txt
21+
- name: Build documentation
22+
run: sphinx-build -nWaE . _build
23+
- name: Link Checker
24+
id: lychee
25+
uses: lycheeverse/lychee-action@v2
26+
with:
27+
args: _build
28+
fail: false
29+
- name: Create Issue From File
30+
if: steps.lychee.outputs.exit_code != 0
31+
uses: peter-evans/create-issue-from-file@v5
32+
with:
33+
title: Link Checker Report
34+
content-filepath: ./lychee/out.md
35+
labels: broken links

.github/workflows/build.yml renamed to .github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Build
1+
name: Test
22
on:
33
push:
44
pull_request:
55
jobs:
6-
build:
6+
test:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v3
@@ -15,3 +15,5 @@ jobs:
1515
run: python -m pip install -r requirements.txt
1616
- name: Test
1717
run: pytest
18+
- name: Build documentation
19+
run: sphinx-build -nWaE . _build

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,6 @@ venv.bak/
108108

109109
# scripts/lint_requirements.sh
110110
*-requirements.txt
111+
112+
# Lychee
113+
.lycheecache

CONTRIBUTING.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,23 @@ Continuous Integration
7474

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

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

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

83+
Kontrola rozbitých odkazů
84+
-------------------------
85+
86+
Na repozitáři je zapojená `GitHub Action <https://github.com/lycheeverse/lychee-action>`_, která jednou denně kontroluje, zda všechny odkazy fungují. Kontrolka:
87+
88+
.. image:: https://github.com/pyvec/docs.pyvec.org/actions/workflows/check_links.yml/badge.svg
89+
:target: https://github.com/pyvec/docs.pyvec.org/actions
90+
:alt: Continuous Integration Status (check links)
91+
92+
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`.
93+
8394
.. _generate_grants:
8495

8596
Skript na generování zápisů hlasování o grantech

guides/meetup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ Materiály z přednášek
361361

362362
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>`__.
363363

364-
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>``
364+
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>`__.
365365

366366

367367
.. _srazy-fotky:

lychee.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Interface
2+
verbose = "info"
3+
no_progress = true
4+
cache = true
5+
max_cache_age = "10m"
6+
7+
# Stealth
8+
user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:138.0) Gecko/20100101 Firefox/138.0"
9+
10+
# Prevent 'Too Many Open Files'
11+
max_concurrency = 32
12+
13+
# Check links inside `<code>` and `<pre>` blocks and Markdown code blocks
14+
include_verbatim = true
15+
16+
# Check fragments in links
17+
include_fragments = true
18+
19+
# Add 'Too many requests'
20+
accept = ["100..=103", "200..=299", "429"]
21+
22+
# Be benevolent
23+
max_retries = 5
24+
timeout = 40
25+
26+
# Exclude
27+
exclude = [
28+
"127.0.0.1:8000",
29+
"cz.pycon.org/20XX",
30+
31+
# Anti-scraping protections
32+
"docs.google.com",
33+
"www.facebook.com",
34+
"www.nytimes.com",
35+
"accounts.google.com",
36+
]

0 commit comments

Comments
 (0)