From e515a13f1dc2140047478a7683ecd5e47edb9041 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sat, 6 Sep 2025 11:37:53 -0700 Subject: [PATCH 1/2] Update link checking --- .../config/markdown-link-check-config.json | 11 --------- .github/scripts/lychee-config.toml | 15 ++++++++++++ .../scripts/markdown-link-check-with-retry.sh | 17 -------------- .github/workflows/build.yml | 4 ++-- .github/workflows/reusable-link-check.yml | 19 +++++++++++++++ .../reusable-markdown-link-check.yml | 23 ------------------- mise.toml | 9 ++++++++ 7 files changed, 45 insertions(+), 53 deletions(-) delete mode 100644 .github/config/markdown-link-check-config.json create mode 100644 .github/scripts/lychee-config.toml delete mode 100755 .github/scripts/markdown-link-check-with-retry.sh create mode 100644 .github/workflows/reusable-link-check.yml delete mode 100644 .github/workflows/reusable-markdown-link-check.yml create mode 100644 mise.toml diff --git a/.github/config/markdown-link-check-config.json b/.github/config/markdown-link-check-config.json deleted file mode 100644 index e19e4bb31e..0000000000 --- a/.github/config/markdown-link-check-config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "retryOn429" : true, - "ignorePatterns" : [ - { - "pattern" : "^http://localhost:.*" - }, - { - "pattern" : "^http://0\\.0\\.0\\.0:.*" - } - ] -} diff --git a/.github/scripts/lychee-config.toml b/.github/scripts/lychee-config.toml new file mode 100644 index 0000000000..e6f970ae4b --- /dev/null +++ b/.github/scripts/lychee-config.toml @@ -0,0 +1,15 @@ +# Lychee configuration file +# See https://lychee.cli.rs/config/ + +timeout = 30 +retry_wait_time = 5 +max_retries = 6 +max_concurrency = 4 + +# Check link anchors +include_fragments = true + +exclude = [ + "^http://localhost:", + "^http://0.0.0.0:", +] diff --git a/.github/scripts/markdown-link-check-with-retry.sh b/.github/scripts/markdown-link-check-with-retry.sh deleted file mode 100755 index 9a81e8df95..0000000000 --- a/.github/scripts/markdown-link-check-with-retry.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -e - -# this script helps to reduce sporadic link check failures by retrying at a file-by-file level - -retry_count=3 - -for file in "$@"; do - for i in $(seq 1 $retry_count); do - if markdown-link-check --config "$(dirname "$0")/../config/markdown-link-check-config.json" \ - "$file"; then - break - elif [[ $i -eq $retry_count ]]; then - exit 1 - fi - sleep 5 - done -done diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc00b6ddef..f4dca50356 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,8 +65,8 @@ jobs: ../gradlew run # this is not a required check to avoid blocking pull requests if external links break - markdown-link-check: - uses: ./.github/workflows/reusable-markdown-link-check.yml + link-check: + uses: ./.github/workflows/reusable-link-check.yml required-status-check: needs: diff --git a/.github/workflows/reusable-link-check.yml b/.github/workflows/reusable-link-check.yml new file mode 100644 index 0000000000..aa44360653 --- /dev/null +++ b/.github/workflows/reusable-link-check.yml @@ -0,0 +1,19 @@ +name: Reusable - Link check + +on: + workflow_call: + +permissions: + contents: read + +jobs: + link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Setup mise + uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0 + + - name: Run link check + run: mise run link-check diff --git a/.github/workflows/reusable-markdown-link-check.yml b/.github/workflows/reusable-markdown-link-check.yml deleted file mode 100644 index 58c7886d99..0000000000 --- a/.github/workflows/reusable-markdown-link-check.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Reusable - Markdown link check - -on: - workflow_call: - -permissions: - contents: read - -jobs: - markdown-link-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: Install markdown-link-check - # TODO(jack-berg): use latest when config file reading bug is fixed: https://github.com/tcort/markdown-link-check/issues/246 - run: npm install -g markdown-link-check@3.10.3 - - - name: Run markdown-link-check - run: | - find . -type f \ - -name '*.md' \ - | xargs .github/scripts/markdown-link-check-with-retry.sh diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000000..014feb7a19 --- /dev/null +++ b/mise.toml @@ -0,0 +1,9 @@ +[tools] +lychee = "0.18.1" + +[tasks.link-check] +run = 'lychee --verbose --config .github/scripts/lychee-config.toml .' + +[settings] +# Only install tools explicitly defined in the [tools] section above +idiomatic_version_file_enable_tools = [] From 0d659ed569f74f90da00cde49eb5e190df2148bb Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sat, 6 Sep 2025 11:48:48 -0700 Subject: [PATCH 2/2] move --- .github/{scripts/lychee-config.toml => config/lychee.toml} | 0 mise.toml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/{scripts/lychee-config.toml => config/lychee.toml} (100%) diff --git a/.github/scripts/lychee-config.toml b/.github/config/lychee.toml similarity index 100% rename from .github/scripts/lychee-config.toml rename to .github/config/lychee.toml diff --git a/mise.toml b/mise.toml index 014feb7a19..b8e424c76e 100644 --- a/mise.toml +++ b/mise.toml @@ -2,7 +2,7 @@ lychee = "0.18.1" [tasks.link-check] -run = 'lychee --verbose --config .github/scripts/lychee-config.toml .' +run = 'lychee --verbose --config .github/config/lychee.toml .' [settings] # Only install tools explicitly defined in the [tools] section above