diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml new file mode 100644 index 0000000000..fc5ad663f6 --- /dev/null +++ b/.github/workflows/links.yml @@ -0,0 +1,36 @@ +--- +# desc: lint sanity check +name: Links (Fail Fast) + +on: + push: + pull_request: + workflow_dispatch: + + +jobs: + lint: + name: pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - name: Restore lychee cache + uses: actions/cache@v3 + with: + path: .lycheecache + key: cache-lychee-${{ github.sha }} + restore-keys: cache-lychee- + + - name: Link Checker + uses: lycheeverse/lychee-action@v1.9.0 + with: + fail: true + args: --base . --cache --max-cache-age 1d . --verbose --no-progress 'docs/**/*.md' 'versioned_docs/**/*.md' + + # - name: Create Issue From File + # if: env.lychee_exit_code != 0 + # uses: peter-evans/create-issue-from-file@v4 + # with: + # title: Link Checker Report + # content-filepath: ./lychee/out.md + # labels: report, automated issue \ No newline at end of file diff --git a/lychee.toml b/lychee.toml new file mode 100644 index 0000000000..53532a9952 --- /dev/null +++ b/lychee.toml @@ -0,0 +1,12 @@ +# 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, 429] +# retry +max_retries = 6 +# Explicitly exclude some URLs +exclude = [ + "^file:", +] \ No newline at end of file