From f75c55ca465d9e5b04695938f199a01279d62e17 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 25 Nov 2024 13:37:51 -0800 Subject: [PATCH] Switch link checker to lychee --- .../config/markdown-link-check-config.json | 15 -------------- .../scripts/markdown-link-check-with-retry.sh | 17 ---------------- .../reusable-markdown-link-check.yml | 20 +++++++++---------- 3 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 .github/config/markdown-link-check-config.json delete mode 100755 .github/scripts/markdown-link-check-with-retry.sh diff --git a/.github/config/markdown-link-check-config.json b/.github/config/markdown-link-check-config.json deleted file mode 100644 index 049dd4681..000000000 --- a/.github/config/markdown-link-check-config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "retryOn429": true, - "aliveStatusCodes": [ - 200, - 403 - ], - "ignorePatterns": [ - { - "pattern": "^https://developer\\.mend\\.io/github/open-telemetry/opentelemetry-java-contrib$" - }, - { - "pattern": "^https://github.com/open-telemetry/opentelemetry-java-contrib/pulls/app%2Frenovate" - } - ] -} 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 9a81e8df9..000000000 --- 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/reusable-markdown-link-check.yml b/.github/workflows/reusable-markdown-link-check.yml index 4e7ad15c4..f69165fb7 100644 --- a/.github/workflows/reusable-markdown-link-check.yml +++ b/.github/workflows/reusable-markdown-link-check.yml @@ -9,13 +9,13 @@ jobs: steps: - uses: actions/checkout@v4 - - 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' \ - -not -path './CHANGELOG.md' \ - | xargs .github/scripts/markdown-link-check-with-retry.sh + - uses: lycheeverse/lychee-action@v2 + with: + # remove version after next release of lychee-action + lycheeVersion: latest + # excluding links to pull requests and issues is done for performance + args: > + --include-fragments + --exclude "^https://github.com/open-telemetry/opentelemetry-java-contrib/(issue|pull)/\\d+$" + --max-retries 6 + .