Skip to content

Commit d4108f8

Browse files
committed
Make typos emit only annotations
1 parent 33f9901 commit d4108f8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/pull_request.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,21 @@ jobs:
3333
runs-on: ubuntu-latest
3434
steps:
3535
- uses: actions/checkout@v4
36-
- uses: crate-ci/typos@master
36+
- run: |
37+
set -o pipefail
38+
mkdir -p "${{ runner.temp }}/typos"
39+
RELEASE_ASSET_URL="$(
40+
gh api /repos/crate-ci/typos/releases/latest \
41+
--jq '."assets"[] | select(."name" | test("^typos-.+-x86_64-unknown-linux-musl\\.tar\\.gz$")) | ."browser_download_url"'
42+
)"
43+
wget --quiet --output-document=- "${RELEASE_ASSET_URL}" \
44+
| tar -xz -C "${{ runner.temp }}/typos" ./typos
45+
git grep --files-with-matches --null -I -e '.' \
46+
| xargs --null --verbose -- "${{ runner.temp }}/typos/typos" --format json \
47+
| jq --raw-output '"::warning file=\(.path),line=\(.line_num),col=\(.byte_offset)::\"\(.typo)\" should be \"" + (.corrections // [] | join("\" or \"") + "\".")' \
48+
|| true
49+
env:
50+
GH_TOKEN: ${{ github.token }}
3751
3852
env:
3953
FORCE_COLOR: 3

0 commit comments

Comments
 (0)