From 7e2847ebbfdb9eaa77a4090f9e9a64da84c20681 Mon Sep 17 00:00:00 2001 From: leiicamundi <153937047+leiicamundi@users.noreply.github.com> Date: Tue, 21 May 2024 09:10:47 +0200 Subject: [PATCH 1/2] chore: use lychee for link checking --- .github/markdown-links.json | 20 ------------------- .github/workflows/links.yml | 40 +++++++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 8 +------- lychee-links.toml | 19 ++++++++++++++++++ 4 files changed, 60 insertions(+), 27 deletions(-) delete mode 100644 .github/markdown-links.json create mode 100644 .github/workflows/links.yml create mode 100644 lychee-links.toml diff --git a/.github/markdown-links.json b/.github/markdown-links.json deleted file mode 100644 index 6d17351..0000000 --- a/.github/markdown-links.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "projectBaseUrl":"${workspaceFolder}", - "ignorePatterns": [ - { - "pattern": "^http(s?)://localhost" - }, - { - "pattern": "^#" - } - ], - "replacementPatterns": [ - ], - "httpHeaders": [ - ], - "timeout": "20s", - "retryOn429": true, - "retryCount": 5, - "fallbackRetryDelay": "30s", - "aliveStatusCodes": [200, 206] -} diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml new file mode 100644 index 0000000..79d7d9b --- /dev/null +++ b/.github/workflows/links.yml @@ -0,0 +1,40 @@ +name: Check external links + +on: + push: + workflow_dispatch: + schedule: + - cron: "0 3 1 * *" + +jobs: + lint: + name: links-check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + + - name: Get Current Timestamp + id: timestamp + run: echo "TIMESTAMP=$(date +%s)" >> "$GITHUB_ENV" + + - name: Restore lychee cache + uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3 + with: + path: .lycheecache + key: "cache-lychee-${{ env.TIMESTAMP }}" + restore-keys: cache-lychee- + + - name: Link Checker + uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 # v1.10.0 + with: + fail: true + args: -c ./lychee-links.toml --base . --cache --max-cache-age 1d . --verbose --no-progress '*.md' './**/*.md' + token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Create Issue From File + if: ${{ github.event_name == 'schedule' && env.lychee_exit_code != 0 }} + uses: peter-evans/create-issue-from-file@433e51abf769039ee20ba1293a088ca19d573b7f # v4 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 623ccf7..4f88067 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,18 +28,12 @@ repos: args: ["--strict"] - repo: https://github.com/compilerla/conventional-pre-commit - rev: v3.2.0 + rev: v3.2.0 # use tags until renovate supports sha: https://github.com/renovatebot/renovate/issues/22567 hooks: - id: conventional-pre-commit stages: [commit-msg] args: ["--strict" , "--force-scope"] -- repo: https://github.com/tcort/markdown-link-check - rev: v3.12.1 # use tags until renovate supports sha: https://github.com/renovatebot/renovate/issues/22567 - hooks: - - id: markdown-link-check - args: [-q, -c .github/markdown-links.json] - - repo: https://github.com/antonbabenko/pre-commit-terraform rev: v1.88.4 hooks: diff --git a/lychee-links.toml b/lychee-links.toml new file mode 100644 index 0000000..8fe7ed8 --- /dev/null +++ b/lychee-links.toml @@ -0,0 +1,19 @@ +# Cache the results of Lychee if ran locally in order to minimise the chance of rate limiting +cache = true +# Ignore all private link (such as localhost) to avoid errors +exclude_all_private = true +# HTTP status code: 429 (Too Many Requests) will also be treated as a valid link if Lychee gets rate limited +accept = ["200", "403"] +# retry +max_retries = 6 +retry_wait_time = 10 +max_concurrency = 3 + +# Exclude all unsupported versioned_docs +exclude_path = [ +] + +# Explicitly exclude some URLs +exclude = [ + "^file:", +] From 04953f109546ba2c00b6b898a944be423962319d Mon Sep 17 00:00:00 2001 From: leiicamundi <153937047+leiicamundi@users.noreply.github.com> Date: Tue, 21 May 2024 09:11:26 +0200 Subject: [PATCH 2/2] chore: make sure renovate use a single group --- .github/renovate.json5 | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 258f0fd..57f041c 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,4 +1,5 @@ { $schema: "https://docs.renovatebot.com/renovate-schema.json", extends: ["github>camunda/infraex-common-config:default.json5"], + groupName: "mono-update-renovate", // we keep all updates in a single renovate branch in order to save CI tests }