feat(action): Report typos to github

This commit is contained in:
Ed Page 2022-06-16 10:18:42 -05:00
parent fc7f517466
commit 2ae4d92451
2 changed files with 6 additions and 1 deletions

View file

@ -1,7 +1,7 @@
FROM ubuntu:20.04
ARG VERSION=1.9.0
ENV VERSION=${VERSION}
RUN apt-get update && apt-get install -y wget git
RUN apt-get update && apt-get install -y wget git jq
RUN wget https://github.com/crate-ci/typos/releases/download/v${VERSION}/typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz && \
tar -xzvf typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz && \
mv typos /usr/local/bin

View file

@ -40,4 +40,9 @@ if [[ -n "${INPUT_CONFIG:-}" ]]; then
fi
log "$ ${COMMAND}"
${COMMAND} --format json |
jq --sort-keys --raw-output '"::warning file=\(.path),line=\(.line_num),col=\(.byte_offset)::\"\(.typo)\" should be \"" + (.corrections // [] | join("\" or \"") + "\".")' |
while IFS= read -r line; do
echo "$line"
done || true
${COMMAND}