From 6297346b253d60110c31f85286966a055314dfd4 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Thu, 5 Dec 2024 07:48:29 -0800 Subject: [PATCH 1/8] lychee --- Makefile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6f2cf5c809..1717afdd3f 100644 --- a/Makefile +++ b/Makefile @@ -68,11 +68,17 @@ misspell-correction: $(MISSPELL) .PHONY: markdown-link-check markdown-link-check: - @if ! npm ls markdown-link-check; then npm install; fi - @for f in $(ALL_DOCS); do \ - npx --no -- markdown-link-check --quiet --config .markdown_link_check_config.json $$f \ - || exit 1; \ - done + # --insecure is currently needed for https://osi-model.com + docker run --rm \ + --mount 'type=bind,source=$(PWD),target=/home/repo' \ + lycheeverse/lychee:latest \ + --root-dir /home/repo \ + --include-fragments \ + --accept 200..=299,403 \ + --exclude https://www.foo.bar \ + --insecure \ + -v \ + home/repo .PHONY: markdown-link-check-changelog-preview markdown-link-check-changelog-preview: From 37388c8ddb9731d86a933371583a76ee659f8f07 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 18 Dec 2024 07:36:28 -0800 Subject: [PATCH 2/8] more retries --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 1717afdd3f..599f108422 100644 --- a/Makefile +++ b/Makefile @@ -77,6 +77,7 @@ markdown-link-check: --accept 200..=299,403 \ --exclude https://www.foo.bar \ --insecure \ + --max-retries 5 \ -v \ home/repo From cb1578ebac2a415025ecab0d407e09f5ec4748ec Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 18 Dec 2024 07:42:52 -0800 Subject: [PATCH 3/8] just to be safe --- .github/workflows/checks.yml | 7 +++++++ Makefile | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 024f8309b2..8235618dde 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -43,6 +43,13 @@ jobs: - name: install dependencies run: npm install + - name: Restore lychee cache + uses: actions/cache@v4 + with: + path: .lycheecache + key: cache-lychee-${{ github.sha }} + restore-keys: cache-lychee- + - name: run markdown-link-check run: make markdown-link-check diff --git a/Makefile b/Makefile index 599f108422..cf89a53f9e 100644 --- a/Makefile +++ b/Makefile @@ -77,7 +77,7 @@ markdown-link-check: --accept 200..=299,403 \ --exclude https://www.foo.bar \ --insecure \ - --max-retries 5 \ + --max-retries 6 \ -v \ home/repo From 9a04ca98579e973570808c0ef0c67a855ecc2adc Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 18 Dec 2024 07:48:37 -0800 Subject: [PATCH 4/8] remove redundant tag --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cf89a53f9e..7752f52cfc 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,7 @@ markdown-link-check: # --insecure is currently needed for https://osi-model.com docker run --rm \ --mount 'type=bind,source=$(PWD),target=/home/repo' \ - lycheeverse/lychee:latest \ + lycheeverse/lychee \ --root-dir /home/repo \ --include-fragments \ --accept 200..=299,403 \ From e36a2a8591ac3d69445567e53a1a549065173c59 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 18 Dec 2024 07:51:15 -0800 Subject: [PATCH 5/8] Remove old config --- .markdown_link_check_config.json | 37 -------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .markdown_link_check_config.json diff --git a/.markdown_link_check_config.json b/.markdown_link_check_config.json deleted file mode 100644 index 980cc95414..0000000000 --- a/.markdown_link_check_config.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "ignorePatterns": [ - { - "pattern": "^https://github\\.com/open-telemetry/opentelemetry-specification/(issues|pull)" - }, - { - "pattern": "^https://github\\.com/open-telemetry/semantic-conventions/(issues|pull|actions)" - }, - { - "pattern": "^https://blogs.oracle.com/linux/post/understanding-linux-kernel-memory-statistics$" - }, - { - "pattern": "^#" - } - ], - "replacementPatterns": [ - { - "pattern": "^/", - "replacement": "{{BASEURL}}/" - }, - { - "pattern": "^https://github.com/open-telemetry/semantic-conventions/(blob|tree)/main/docs/", - "replacement": "LINK-CHECK-ERROR-USE-LOCAL-PATH-TO-DOC-PAGE-NOT-EXTERNAL-URL/" - } - ], - "httpHeaders": [ - { - "urls": ["http", ".", "/"], - "headers": { - "User-Agent": "Mozilla/5.0 (compatible; OpenTelemetryDocsBot/1.0)" - } - } - ], - "retryOn429": true, - "timeout": "30s", - "aliveStatusCodes": [200, 403] -} From 2d332d62ceda5453cf6b469b7ec5653ff20bfed2 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 18 Dec 2024 08:23:01 -0800 Subject: [PATCH 6/8] move to toml config --- .lychee.toml | 16 ++++++++++++++++ Makefile | 7 +------ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 .lychee.toml diff --git a/.lychee.toml b/.lychee.toml new file mode 100644 index 0000000000..e743ac2107 --- /dev/null +++ b/.lychee.toml @@ -0,0 +1,16 @@ +include-fragments = true + +accept = ["200..=299", "403"] + +exclude = [ + "^https://www.foo.bar", + # excluding links to pull requests and issues is done for performance + "^https://github.com/open-telemetry/semantic-conventions/pull/\\d+$", + "^https://github.com/open-telemetry/semantic-conventions/issue/\\d+$" +] + +# better to be safe and avoid failures +max-retries = 6 + +# insecure is currently needed for https://osi-model.com +insecure = true diff --git a/Makefile b/Makefile index 7752f52cfc..cec02e4e9f 100644 --- a/Makefile +++ b/Makefile @@ -68,16 +68,11 @@ misspell-correction: $(MISSPELL) .PHONY: markdown-link-check markdown-link-check: - # --insecure is currently needed for https://osi-model.com docker run --rm \ --mount 'type=bind,source=$(PWD),target=/home/repo' \ lycheeverse/lychee \ + --config home/repo/.lychee.toml \ --root-dir /home/repo \ - --include-fragments \ - --accept 200..=299,403 \ - --exclude https://www.foo.bar \ - --insecure \ - --max-retries 6 \ -v \ home/repo From b663e2c0add558bf563b972c114f0c9ea540c78d Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 18 Dec 2024 09:03:28 -0800 Subject: [PATCH 7/8] Update .github/workflows/checks.yml --- .github/workflows/checks.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8235618dde..024f8309b2 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -43,13 +43,6 @@ jobs: - name: install dependencies run: npm install - - name: Restore lychee cache - uses: actions/cache@v4 - with: - path: .lycheecache - key: cache-lychee-${{ github.sha }} - restore-keys: cache-lychee- - - name: run markdown-link-check run: make markdown-link-check From 91835efae435e10d5452bc53285fc464d2f24a51 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 18 Dec 2024 09:35:42 -0800 Subject: [PATCH 8/8] single regex --- .lychee.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.lychee.toml b/.lychee.toml index e743ac2107..812f0efbb0 100644 --- a/.lychee.toml +++ b/.lychee.toml @@ -5,8 +5,7 @@ accept = ["200..=299", "403"] exclude = [ "^https://www.foo.bar", # excluding links to pull requests and issues is done for performance - "^https://github.com/open-telemetry/semantic-conventions/pull/\\d+$", - "^https://github.com/open-telemetry/semantic-conventions/issue/\\d+$" + "^https://github.com/open-telemetry/semantic-conventions/(pull|issue)/\\d+$" ] # better to be safe and avoid failures