From d186e04e09a5ed7686ce54befbe0054bb2bb7d98 Mon Sep 17 00:00:00 2001 From: Navya Naidu Date: Mon, 21 Sep 2026 14:15:33 +0530 Subject: [PATCH 1/2] Check newly added links in PRs --- .github/workflows/test.yml | 13 ++++++++++++- source/conf.py | 12 ++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 81ea4f0541..80951276f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,6 +53,12 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade nox virtualenv + - name: Restore linkcheck baseline + if: matrix.noxenv == 'linkcheck' && (github.event_name == 'pull_request' || github.event_name == 'merge_group') + uses: actions/cache/restore@v4 + with: + path: build/output.json + key: linkcheck-baseline-${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.sha }} - name: Nox ${{ matrix.noxenv }} env: @@ -60,7 +66,12 @@ jobs: GITHUB_TOKEN: ${{ matrix.noxenv == 'linkcheck' && github.token || '' }} run: | python -m nox -s ${{ matrix.noxenv }} - + - name: Save linkcheck baseline + if: always() && matrix.noxenv == 'linkcheck' && github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + path: build/output.json + key: linkcheck-baseline-${{ github.sha }} check: # This job does nothing and is only used for the branch protection diff --git a/source/conf.py b/source/conf.py index d44be01630..27a01a69f7 100644 --- a/source/conf.py +++ b/source/conf.py @@ -1,8 +1,10 @@ # -- Project information --------------------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +import json import os import pathlib +import re import sys _ROOT = pathlib.Path(__file__).resolve().parent.parent @@ -165,6 +167,16 @@ # Temporarily ignored due to expired TLS cert. r"https://kivy.org/.*", ] +if ( + os.getenv("GITHUB_ACTIONS") == "true" + and os.getenv("GITHUB_EVENT_NAME") in {"pull_request", "merge_group"} + and (baseline := pathlib.Path("build/output.json")).exists() +): + with baseline.open() as f: + linkcheck_ignore.extend( + re.escape(json.loads(line)["uri"]) + for line in f + ) linkcheck_retries = 2 linkcheck_timeout = 30 # Ignore anchors for common targets when we know they likely won't be found From 1e8c01ffb5f74b39810a9c2993e8cea8a108bf3d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Sep 2026 08:58:20 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- source/conf.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/conf.py b/source/conf.py index 27a01a69f7..4ced2db4ab 100644 --- a/source/conf.py +++ b/source/conf.py @@ -173,10 +173,7 @@ and (baseline := pathlib.Path("build/output.json")).exists() ): with baseline.open() as f: - linkcheck_ignore.extend( - re.escape(json.loads(line)["uri"]) - for line in f - ) + linkcheck_ignore.extend(re.escape(json.loads(line)["uri"]) for line in f) linkcheck_retries = 2 linkcheck_timeout = 30 # Ignore anchors for common targets when we know they likely won't be found