From 3ebef6ad2075e313c50b6e72005d0766dc4e9496 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 14:29:26 +0200 Subject: [PATCH 01/12] ci: add check for dead links --- .github/workflows/link_check.yml | 33 ++++++++++++++++++++++++++++++++ lychee.toml | 4 ++++ 2 files changed, 37 insertions(+) create mode 100644 .github/workflows/link_check.yml create mode 100644 lychee.toml diff --git a/.github/workflows/link_check.yml b/.github/workflows/link_check.yml new file mode 100644 index 0000000..a6afed4 --- /dev/null +++ b/.github/workflows/link_check.yml @@ -0,0 +1,33 @@ +name: Offline Check for dead links + +on: + push: + +permissions: + contents: read + +jobs: + link-check: + name: Offline Link Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mkdocs mkdocs-material mkdocs-static-i18n[material] + + - name: Build + run: mkdocs build + + - name: Check offline links + uses: lycheeverse/lychee-action@v2.0.2 + with: + args: --config lychee.toml --no-progress --offline '**/*.html' + fail: true diff --git a/lychee.toml b/lychee.toml new file mode 100644 index 0000000..c7eda8a --- /dev/null +++ b/lychee.toml @@ -0,0 +1,4 @@ +exclude_path = [ + "site/custom/partials/", + "docs/custom/partials/" +] From 62eca63ae95a28074afbe7f63aa81a316230474e Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 14:58:34 +0200 Subject: [PATCH 02/12] ci: add scheduled offline link check --- .github/workflows/link_check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/link_check.yml b/.github/workflows/link_check.yml index a6afed4..f89b5df 100644 --- a/.github/workflows/link_check.yml +++ b/.github/workflows/link_check.yml @@ -2,6 +2,8 @@ name: Offline Check for dead links on: push: + schedule: + - cron: "00 20 * * *" permissions: contents: read From 2ff15d2c4972dc6f83fe3c65d1bd9d75c05dee25 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 14:58:57 +0200 Subject: [PATCH 03/12] ci: add issue creation when dead offline links are found --- .github/workflows/link_check.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/link_check.yml b/.github/workflows/link_check.yml index f89b5df..a108852 100644 --- a/.github/workflows/link_check.yml +++ b/.github/workflows/link_check.yml @@ -7,6 +7,7 @@ on: permissions: contents: read + issues: write jobs: link-check: @@ -29,7 +30,16 @@ jobs: run: mkdocs build - name: Check offline links + id: lychee-check uses: lycheeverse/lychee-action@v2.0.2 with: args: --config lychee.toml --no-progress --offline '**/*.html' fail: true + + - name: Create Issue for dead links + if: steps.lychee-check.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v5 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue From 1a547c0281fae679372bfcd439febe7286bc09c8 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 15:04:55 +0200 Subject: [PATCH 04/12] chore: add depandabot --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3d3e2b9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "./github/workflows" + schedule: + interval: "daily" From 1adc2ec90b67a1e4bfc8c609c0e38ef5d3795255 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 15:57:18 +0200 Subject: [PATCH 05/12] ci: limit link check to push, PR on main --- .github/workflows/link_check.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/link_check.yml b/.github/workflows/link_check.yml index a108852..c777451 100644 --- a/.github/workflows/link_check.yml +++ b/.github/workflows/link_check.yml @@ -2,6 +2,11 @@ name: Offline Check for dead links on: push: + branches: + - main + pull_request: + branches: + - main schedule: - cron: "00 20 * * *" From ad217ab30ff7816a0540f2673256d8006fff3767 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 16:07:07 +0200 Subject: [PATCH 06/12] ci: add checks for external links --- .github/workflows/external_link_check.yml | 45 +++++++++++++++++++ ...{link_check.yml => offline_link_check.yml} | 0 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/external_link_check.yml rename .github/workflows/{link_check.yml => offline_link_check.yml} (100%) diff --git a/.github/workflows/external_link_check.yml b/.github/workflows/external_link_check.yml new file mode 100644 index 0000000..540ae8c --- /dev/null +++ b/.github/workflows/external_link_check.yml @@ -0,0 +1,45 @@ +name: Offline Check for dead links + +on: + workflow_dispatch: + schedule: + - cron: "00 20 * * *" + +permissions: + contents: read + issues: write + +jobs: + extermal-link-check: + name: External Link Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mkdocs mkdocs-material mkdocs-static-i18n[material] + + - name: Build + run: mkdocs build + + - name: Check offline links + id: lychee-check + uses: lycheeverse/lychee-action@v2.0.2 + with: + args: --config lychee.toml --no-progress '**/*.html' + fail: true + + - name: Create Issue for dead links + if: steps.lychee-check.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v5 + with: + title: External Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue diff --git a/.github/workflows/link_check.yml b/.github/workflows/offline_link_check.yml similarity index 100% rename from .github/workflows/link_check.yml rename to .github/workflows/offline_link_check.yml From 010b5eaf9197624591b9500f521eee4169a96356 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 16:11:42 +0200 Subject: [PATCH 07/12] ci: limit external link check to weekly --- .github/workflows/external_link_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/external_link_check.yml b/.github/workflows/external_link_check.yml index 540ae8c..0d1d8fe 100644 --- a/.github/workflows/external_link_check.yml +++ b/.github/workflows/external_link_check.yml @@ -3,7 +3,7 @@ name: Offline Check for dead links on: workflow_dispatch: schedule: - - cron: "00 20 * * *" + - cron: "0 0 * * MON" permissions: contents: read From 65e473d9eceab5cc9ee0c923668be78d6ce99607 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 16:18:07 +0200 Subject: [PATCH 08/12] ci: add caching to external link checker --- .github/workflows/external_link_check.yml | 7 +++++++ lychee.toml | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/external_link_check.yml b/.github/workflows/external_link_check.yml index 0d1d8fe..f41ab79 100644 --- a/.github/workflows/external_link_check.yml +++ b/.github/workflows/external_link_check.yml @@ -29,6 +29,13 @@ jobs: - name: Build run: mkdocs build + - name: Restore lychee cache + uses: actions/cache@v4 + with: + path: .lycheecache + key: cache-lychee-${{ github.sha }} + restore-keys: cache-lychee- + - name: Check offline links id: lychee-check uses: lycheeverse/lychee-action@v2.0.2 diff --git a/lychee.toml b/lychee.toml index c7eda8a..ae31ae4 100644 --- a/lychee.toml +++ b/lychee.toml @@ -2,3 +2,11 @@ exclude_path = [ "site/custom/partials/", "docs/custom/partials/" ] +cache = true +max_cache_age = "2w" +user_agent = "curl/8.11.1" +timeout = 20 +max_retries = 2 +retry_wait_time = 5 +require_https = true +exclude_mail = true From 576410d77c3c0842ab85e374bc94d79b53ef0732 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 16:20:53 +0200 Subject: [PATCH 09/12] ci: use better name for external link check --- .github/workflows/external_link_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/external_link_check.yml b/.github/workflows/external_link_check.yml index f41ab79..ccdde1a 100644 --- a/.github/workflows/external_link_check.yml +++ b/.github/workflows/external_link_check.yml @@ -1,4 +1,4 @@ -name: Offline Check for dead links +name: Check for dead external links on: workflow_dispatch: From b4c51c51afb114748fd2561ad04279847ebcb528 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 16:25:49 +0200 Subject: [PATCH 10/12] ci: use shorter workflow name for badge --- .github/workflows/link_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/link_check.yml b/.github/workflows/link_check.yml index c777451..578c802 100644 --- a/.github/workflows/link_check.yml +++ b/.github/workflows/link_check.yml @@ -1,4 +1,4 @@ -name: Offline Check for dead links +name: Internal Links on: push: From 9e3a40bcdcd5e6a82281cf125e772b6650bebfd7 Mon Sep 17 00:00:00 2001 From: bressco Date: Tue, 30 Sep 2025 16:25:49 +0200 Subject: [PATCH 11/12] ci: use shorter workflow name for badge --- .github/workflows/link_check.yml | 2 +- README.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/link_check.yml b/.github/workflows/link_check.yml index c777451..578c802 100644 --- a/.github/workflows/link_check.yml +++ b/.github/workflows/link_check.yml @@ -1,4 +1,4 @@ -name: Offline Check for dead links +name: Internal Links on: push: diff --git a/README.md b/README.md index ebebbcc..36b6c53 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: CC BY 4.0](https://img.shields.io/badge/License-CC_BY_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/) +[![Check internal +Links](https://github.com/fairagro/knowledgebase/actions/workflows/links.yml/badge.svg)](https://github.com/fairagro/knowledgebase/actions/workflows/links.yml) + This is the GitHub Repo of the [FAIRagro](https://fairagro.net/en) Knowledge Base, operated by the FAIRagro [DSSC](https://fairagro.net/en/helpdesk) (Data Steward Service Center). The Knowledge Base is deployed via GitHub-Pages using [GitHub Icon](https://github.com/squidfunk/mkdocs-material) [mkdocs-material](https://github.com/squidfunk/mkdocs-material). From a8fedaeca212b022d07ccb03fecd485544210be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20Bre=C3=9F?= Date: Mon, 22 Dec 2025 15:18:55 +0100 Subject: [PATCH 12/12] ci: harmonize internal and external link checking --- .github/workflows/external_link_check.yml | 8 +++++++- .github/workflows/offline_link_check.yml | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/external_link_check.yml b/.github/workflows/external_link_check.yml index ccdde1a..9183fb5 100644 --- a/.github/workflows/external_link_check.yml +++ b/.github/workflows/external_link_check.yml @@ -4,13 +4,19 @@ on: workflow_dispatch: schedule: - cron: "0 0 * * MON" + push: + branches: + - main + pull_request: + branches: + - main permissions: contents: read issues: write jobs: - extermal-link-check: + external-link-check: name: External Link Check runs-on: ubuntu-latest steps: diff --git a/.github/workflows/offline_link_check.yml b/.github/workflows/offline_link_check.yml index 578c802..8f56018 100644 --- a/.github/workflows/offline_link_check.yml +++ b/.github/workflows/offline_link_check.yml @@ -1,4 +1,4 @@ -name: Internal Links +name: Check for dead internal links on: push: @@ -16,7 +16,7 @@ permissions: jobs: link-check: - name: Offline Link Check + name: Internal Link Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -45,6 +45,6 @@ jobs: if: steps.lychee-check.outputs.exit_code != 0 uses: peter-evans/create-issue-from-file@v5 with: - title: Link Checker Report + title: Internal Link Checker Report content-filepath: ./lychee/out.md labels: report, automated issue