From d537ddc62bfabfe383c0bd402833377003a1d8dc Mon Sep 17 00:00:00 2001 From: Sarasa Kisaragi Date: Wed, 18 Aug 2021 14:24:44 +0800 Subject: [PATCH] feat: add link check (#635) Signed-off-by: Ling Samuel --- .github/actions/markdown-link-check | 1 + .github/workflows/lint-checker.yml | 20 ++++++++++++++++++ .gitmodules | 3 +++ README.md | 5 +++-- link-check-config.json | 32 +++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 2 deletions(-) create mode 160000 .github/actions/markdown-link-check create mode 100644 link-check-config.json diff --git a/.github/actions/markdown-link-check b/.github/actions/markdown-link-check new file mode 160000 index 0000000000..9710f0fec8 --- /dev/null +++ b/.github/actions/markdown-link-check @@ -0,0 +1 @@ +Subproject commit 9710f0fec812ce0a3b98bef4c9d842fc1f39d976 diff --git a/.github/workflows/lint-checker.yml b/.github/workflows/lint-checker.yml index 44ecc5fccc..b9e81e1c49 100644 --- a/.github/workflows/lint-checker.yml +++ b/.github/workflows/lint-checker.yml @@ -91,3 +91,23 @@ jobs: node-version: '12.x' - run: npm install -g markdownlint-cli@0.25.0 - run: markdownlint '**/*.md' --ignore node_modules --ignore CHANGELOG.md + markdown-link-check: + needs: changes + if: | + (needs.changes.outputs.docs == 'true') + runs-on: ubuntu-latest + name: Check Markdown links + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: ./.github/actions/markdown-link-check + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + config-file: 'link-check-config.json' + folder-path: 'docs/en' + file-path: './README.md, ./install.md, ./test/e2e/README.md' + max-depth: -1 + file-extension: ".md" + check-modified-files-only: "no" diff --git a/.gitmodules b/.gitmodules index c4f5dbb345..f2d43b05db 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule ".github/actions/paths-filter"] path = .github/actions/paths-filter url = https://github.com/dorny/paths-filter.git +[submodule ".github/actions/markdown-link-check"] + path = .github/actions/markdown-link-check + url = https://github.com/gaurav-nelson/github-action-markdown-link-check.git diff --git a/README.md b/README.md index 1c605fca5a..4062417d15 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ Use [Apache APISIX](https://github.com/apache/apisix#apache-apisix) for Kubernetes [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/). -All configurations in `apisix-ingress-controller` are defined with Kubernetes CRDs (Custom Resource Definitions). Such as configure [plugins](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins.md), Support service registration discovery mechanism for upstreams, load balancing and more in Apache APISIX. +All configurations in `apisix-ingress-controller` are defined with Kubernetes CRDs (Custom Resource Definitions). +Support configuring [plugins](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins), service registration discovery mechanism for upstreams, load balancing and more in Apache APISIX. `apisix-ingress-controller` is an Apache APISIX control plane component. Currently it serves for Kubernetes clusters. In the future, we plan to separate the submodule to adapt to more deployment modes, such as virtual machine clusters. @@ -64,7 +65,7 @@ From the version 1.0.0, APISIX-ingress-controller need to work with Apache APISI ## Apache APISIX Ingress vs. Kubernetes Ingress Nginx * Hot-reload during yaml apply. -* [More convenient canary deployment.](./docs/assets/en/latest/concepts/apisix_route.md) +* [More convenient canary deployment.](./docs/en/latest/concepts/apisix_route.md) * Verify the correctness of the configuration, safe and reliable. * [Rich plugins and ecology.](https://github.com/apache/apisix/tree/master/docs/en/latest/plugins) * Supports APISIX custom resources and Kubernetes native Ingress resources. diff --git a/link-check-config.json b/link-check-config.json new file mode 100644 index 0000000000..12cb61b9b5 --- /dev/null +++ b/link-check-config.json @@ -0,0 +1,32 @@ +{ + "ignorePatterns": [ + { + "pattern": "^https://github.com/.*?/issue" + }, + { + "pattern": "^https://github.com/.*?/pull" + }, + { + "pattern": "^#" + } + ], + "replacementPatterns": [ + { + "pattern": "^https://github.com/apache/apisix-ingress-controller/blob/master/", + "replacement": "{{BASEURL}}/" + }, + { + "pattern": "^https://github.com/apache/apisix-ingress-controller/tree/master/", + "replacement": "{{BASEURL}}/" + }, + { + "pattern": "^https://apisix.apache.org/docs/ingress-controller/(.*?)$", + "replacement": "{{BASEURL}}/docs/en/latest/$1.md" + } + ], + "timeout": "20s", + "retryOn429": true, + "retryCount": 5, + "fallbackRetryDelay": "30s", + "aliveStatusCodes": [200, 206] +}