From 49557824f77c0eb5c6b4e7109398b10d897452bc Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:27:52 -0700 Subject: [PATCH] Don't error on timeouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit linkcheck errors on both timeouts and broken links.¹ We only want the CI job to fail on broken links since timeouts are most likely transient. ¹ https://github.com/sphinx-doc/sphinx/blob/2f1d775dfda9e4f81dfff6cfbe9edf7731e32a97/sphinx/builders/linkcheck.py#L82-L83 --- .github/workflows/docs-ci.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs-ci.yaml b/.github/workflows/docs-ci.yaml index 47cc362..0d9b7c6 100644 --- a/.github/workflows/docs-ci.yaml +++ b/.github/workflows/docs-ci.yaml @@ -46,6 +46,7 @@ env: # --keep-going: find all warnings # https://www.sphinx-doc.org/en/master/man/sphinx-build.html SPHINXOPTS: -n -W --keep-going + BUILDDIR: _build jobs: build: @@ -75,5 +76,16 @@ jobs: - run: make ${{ inputs.make-target }} working-directory: ${{ inputs.docs-directory }} - - run: make linkcheck + # Ignore the exit code, results will be checked in the next step + - run: make linkcheck || true + working-directory: ${{ inputs.docs-directory }} + + - name: Check for broken links + run: | + broken_links=$(jq 'select(.status == "broken")' "$BUILDDIR/linkcheck/output.json") + if [ -n "$broken_links" ]; then + echo "Broken links found:" + echo "$broken_links" + exit 1 + fi working-directory: ${{ inputs.docs-directory }}