-
-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (45 loc) · 1.96 KB
/
spelling.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: "Spelling"
# I take care of your fat fingers and ESL mistakes.
on: # yamllint disable-line rule:truthy
pull_request: null
push:
branches:
- "master"
workflow_call: null
permissions: {} # yamllint disable-line rule:braces
#permissions: "read-all"
#permissions:
# contents: "read" # Private repositories need read permission
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
typos_check:
name: "文A Typos"
runs-on: "ubuntu-22.04"
timeout-minutes: 1
steps:
-
name: "Checkout repository"
uses: "actions/checkout@v4.1.5"
-
name: "Search for misspellings"
#uses: "crate-ci/typos@v1.16.20"
env:
GH_TOKEN: "${{ github.token }}"
# yamllint disable rule:line-length
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 --null --verbose -- "${{ runner.temp }}/typos/typos" --format json \
| jq --raw-output '"::warning file=\(.path),line=\(.line_num),col=\(.byte_offset)::\"\(.typo)\" should be \"" + (.corrections // [] | join("\" or \"") + "\".")'