diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index d7c1a73..1112fe9 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -20,31 +20,37 @@ concurrency: cancel-in-progress: true jobs: - typos_check: - name: "文A Typos" + codespell_check: + name: "文A codespell" runs-on: "ubuntu-22.04" timeout-minutes: 1 steps: - name: "Checkout repository" uses: "actions/checkout@v3.6.0" + - + name: "Cache pip" + uses: "actions/cache@v3" + with: + path: "~/.cache/pip" + key: "${{ runner.os }}-pip-codespell" + - + name: "Install codespell" + run: | + pip install --user 'codespell>=2.2' - name: "Search for misspellings" - #uses: "crate-ci/typos@v1.16.4" - env: - GH_TOKEN: "${{ github.token }}" - # yamllint disable rule:line-length + #uses: "codespell-project/actions-codespell@v2.0" + #with: + # skip: "./.git,package-lock.json" + # check_hidden: true + # check_filenames: true + # builtin: "clear,rare,informal,usage,code,names" + # ignore_words_list: "master" run: | - set -o pipefail - mkdir -p "${{ runner.temp }}/typos" - RELEASE_ASSET_URL="$( - gh api /repos/crate-ci/typos/releases/latest \ - --jq '."assets"[] | select(."name" | test("^typos-.+-x86_64-unknown-linux-musl\\.tar\\.gz$")) | ."browser_download_url"' - )" - wget --secure-protocol=TLSv1_3 --max-redirect=1 --retry-on-host-error --retry-connrefused --tries=3 \ - --quiet --output-document=- "${RELEASE_ASSET_URL}" \ - | tar -xz -C "${{ runner.temp }}/typos" ./typos - "${{ runner.temp }}/typos/typos" --version - git grep --files-with-matches --null -I -e '.' \ - | xargs -0 -t -- "${{ runner.temp }}/typos/typos" --format json \ - | jq --raw-output '"::warning file=\(.path),line=\(.line_num),col=\(.byte_offset)::\"\(.typo)\" should be \"" + (.corrections // [] | join("\" or \"") + "\".")' + "$(python -m site --user-base)/bin/codespell" \ + --skip="./.git,package-lock.json" \ + --check-hidden \ + --check-filenames \ + --builtin="clear,rare,informal,usage,code,names" \ + --ignore-words-list="master"