From c15fdd6110745f28bef4ee984ee8ab3084504c54 Mon Sep 17 00:00:00 2001 From: Tuomo Tanskanen Date: Wed, 19 Apr 2023 10:00:56 +0300 Subject: [PATCH] add broken link checker action Take broken link checker action from CAPM3 and add it here as well. --- .github/workflows/lint-docs.yaml | 24 ++++++++++++++++++++++++ .markdownlinkcheck.json | 18 ++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/lint-docs.yaml create mode 100644 .markdownlinkcheck.json diff --git a/.github/workflows/lint-docs.yaml b/.github/workflows/lint-docs.yaml new file mode 100644 index 0000000000..85f68ab6da --- /dev/null +++ b/.github/workflows/lint-docs.yaml @@ -0,0 +1,24 @@ +name: Check Markdown links + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + paths: + - '**.md' + +permissions: + contents: read + +jobs: + markdown-link-check: + name: Broken Links + # This workflow is only of value to the metal3-io repository and + # would always fail in forks + if: github.repository == 'metal3-io/baremetal-operator' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + - uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # v1 + with: + use-quiet-mode: 'yes' + config-file: .markdownlinkcheck.json diff --git a/.markdownlinkcheck.json b/.markdownlinkcheck.json new file mode 100644 index 0000000000..5bd8ed9aea --- /dev/null +++ b/.markdownlinkcheck.json @@ -0,0 +1,18 @@ +{ + "ignorePatterns": [{ + "pattern": "^http://localhost" + }], + "httpHeaders": [{ + "comment": "Workaround as suggested here: https://github.com/tcort/markdown-link-check/issues/201", + "urls": ["https://docs.github.com/"], + "headers": { + "Accept-Encoding": "zstd, br, gzip, deflate" + } + }], + "timeout": "10s", + "retryOn429": true, + "retryCount": 5, + "fallbackRetryDelay": "30s", + "aliveStatusCodes": [200, 206] +} +