Skip to content

Commit

Permalink
chore: replace markdownlinks by lynchee
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi committed Nov 18, 2024
1 parent c642911 commit 4e222c4
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 23 deletions.
17 changes: 0 additions & 17 deletions .github/markdown-links.json

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Check external links

on:
push:
workflow_dispatch:
schedule:
- cron: 0 3 1 * *
pull_request:
paths:
- .github/workflows/links.yml

jobs:
lint:
name: links-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Get Current Timestamp
id: timestamp
run: echo "TIMESTAMP=$(date +%s)" >> "$GITHUB_ENV"

- name: Restore lychee cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: .lycheecache
key: cache-lychee-${{ env.TIMESTAMP }}
restore-keys: cache-lychee-

- name: Link Checker
uses: lycheeverse/lychee-action@f81112d0d2814ded911bd23e3beaa9dda9093915 # v2.1.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: failure() && github.event_name == 'schedule'
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: report, automated issue

- name: Notify in Slack in case of failure
id: slack-notification
if: failure() && github.event_name == 'schedule'
uses: camunda/infraex-common-config/.github/actions/report-failure-on-slack@4dcb257030b8026f86747777802b10cc6d64c20b # 1.2.5
with:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ repos:
types: [text]
stages: [commit, push, manual]

- repo: https://github.com/tcort/markdown-link-check
rev: v3.13.6 # 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/adrienverge/yamllint
rev: v1.35.1
hooks:
Expand Down
20 changes: 20 additions & 0 deletions lychee-links.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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:",
"^http(s?)://localhost",
]

0 comments on commit 4e222c4

Please sign in to comment.