From 8d1b9d523983ebfcd9af156b34188f05c178f1b6 Mon Sep 17 00:00:00 2001 From: chaosi-zju Date: Thu, 28 Dec 2023 10:08:19 +0800 Subject: [PATCH] add typo check ci action to automatically detect typo error Signed-off-by: chaosi-zju --- .github/workflows/typos.yml | 15 +++++++++++++++ docs/contributor/contribute-docs.md | 8 ++++++++ .../current/contributor/contribute-docs.md | 8 ++++++++ typos.toml | 13 +++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 .github/workflows/typos.yml create mode 100644 typos.toml diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 00000000..ab3c7027 --- /dev/null +++ b/.github/workflows/typos.yml @@ -0,0 +1,15 @@ +name: Typos Check +on: + push: + pull_request: +jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-22.04 + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Check spelling with custom config file + uses: crate-ci/typos@master + with: + config: ./typos.toml diff --git a/docs/contributor/contribute-docs.md b/docs/contributor/contribute-docs.md index 9cbb8554..11a1c667 100644 --- a/docs/contributor/contribute-docs.md +++ b/docs/contributor/contribute-docs.md @@ -176,6 +176,14 @@ Click **Next** and you can see the corresponding changes. If you have changes re If the previewed page is not what you expected, please check your docs again. +### Typos Check (optional) + +You can use [spell checker](https://github.com/crate-ci/typos) to find and correct spelling mistakes after you updated the documents. + +To install the spell checker tool, you can refer to [Install](https://github.com/crate-ci/typos?tab=readme-ov-file#install). + +Then, just executing `typos . --config ./typos.toml` at the repo root path in your local commandline. + ## FAQ ### Versioning diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contributor/contribute-docs.md b/i18n/zh/docusaurus-plugin-content-docs/current/contributor/contribute-docs.md index 32b891b9..59b21ebc 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contributor/contribute-docs.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contributor/contribute-docs.md @@ -180,6 +180,14 @@ items: [ 如果预览的页面与预期不符,请再次检查文档。 +### 拼写检查 (可选) + +更新文件后,你可以使用 [拼写检查工具](https://github.com/crate-ci/typos) 查找并纠正拼写错误。 + +要安装拼写检查工具,可以参考 [安装](https://github.com/crate-ci/typos?tab=readme-ov-file#install)。 + +然后,只需在本地命令行的仓库 root 路径下执行 `typos . --config ./typos.toml`命令。 + ## FAQ ### 版本控制 diff --git a/typos.toml b/typos.toml new file mode 100644 index 00000000..db824f8c --- /dev/null +++ b/typos.toml @@ -0,0 +1,13 @@ +# This is the custom config file used by `typos` command and `crate-ci/typos@master` action to do source code spelling correction. +# Sometimes, what looks like a typo is intentional, like with people's names, acronyms, or localized content. +# To mark a word or an identifier (grouping of words) as valid, add it to this file by declaring itself as the valid spelling. +# See https://github.com/crate-ci/typos/blob/master/docs/reference.md for more info to configure typos. +[files] +extend-exclude = [ + "*.svg", + "*.drawio", +] +[default.extend-words] +BA = "BA" +Ded = "Ded" +EDE = "EDE"