diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 43274313641c..e7e063ff83c1 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -33,7 +33,21 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: crate-ci/typos@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 --quiet --output-document=- "${RELEASE_ASSET_URL}" \ + | tar -xz -C "${{ runner.temp }}/typos" ./typos + 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 \"") + "\".")' \ + || true + env: + GH_TOKEN: ${{ github.token }} env: FORCE_COLOR: 3