diff --git a/.github/workflows/md-link-check.yml b/.github/workflows/md-link-check.yml new file mode 100644 index 0000000..ee2b924 --- /dev/null +++ b/.github/workflows/md-link-check.yml @@ -0,0 +1,44 @@ +# This is a basic workflow to help you get started with Actions + +name: Check broken links + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [master] + pull_request: + branches: [master] + schedule: + # Run everyday at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07) + - cron: "0 5 * * *" + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + check: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "18" + + - name: markdown-link-check + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: "yes" + config-file: "checklink_config.json" + max-depth: 3 + + - name: Archive Broken Links List + uses: actions/upload-artifact@v3 + if: always() + with: + name: broken-links.json + path: /brokenLinks.json + retention-days: 5 \ No newline at end of file diff --git a/README.md b/README.md index 3ada993..3af0e52 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Codacy Badge](https://app.codacy.com/project/badge/Grade/3f16717cd6f841118006f12c346e9341)](https://www.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=LinuxSuRen/api-testing\&utm_campaign=Badge_Grade) -[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/3f16717cd6f841118006f12c346e9341)](https://www.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=LinuxSuRen/api-testing\&utm_campaign=Badge_Coverage) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/3f16717cd6f841118006f12c346e9341)](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) +[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/3f16717cd6f841118006f12c346e9341)](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) ![GitHub All Releases](https://img.shields.io/github/downloads/linuxsuren/api-testing/total) ![](https://sloc.xyz/github/linuxsuren/api-testing) [![LinuxSuRen/open-source-best-practice](https://img.shields.io/static/v1?label=OSBP&message=%E5%BC%80%E6%BA%90%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5&color=blue)](https://github.com/LinuxSuRen/open-source-best-practice) diff --git a/checklink_config.json b/checklink_config.json new file mode 100644 index 0000000..2d83617 --- /dev/null +++ b/checklink_config.json @@ -0,0 +1,10 @@ +{ + "ignorePatterns": [ + { + "pattern": "^(https?://)?(127.0.0.1|localhost|192.168.33.1|somehost\\.com)" + } + ], + "aliveStatusCodes": [ + 200 + ] +} \ No newline at end of file