mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 09:01:04 -05:00
286609cb28
This reverts commit fc7f517466
.
This has two problems
- This doesn't correctly handle spaces, likely needing #708
- This overrides excludes, see #347
This also has a weird cost/benefit balance because this requires enough
repo history to do the analysis which takes time to pull down.
Rather than waiting until the relevant changes are in to make this work,
I'm pulling this out for now.
Fixes #806
51 lines
1.3 KiB
Bash
Executable file
51 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
SOURCE_DIR="$(dirname -- ${BASH_SOURCE[0]:-$0})";
|
|
|
|
log() {
|
|
echo -e "$1" >&2
|
|
}
|
|
|
|
_DEFAULT_INSTALL_DIR=${HOME}/bin
|
|
_INSTALL_DIR=${INSTALL_DIR:-${_DEFAULT_INSTALL_DIR}}
|
|
CMD_NAME="typos"
|
|
COMMAND="${_INSTALL_DIR}/${CMD_NAME}"
|
|
|
|
TARGET=${INPUT_FILES:-"."}
|
|
if [[ -z $(ls ${TARGET} 2>/dev/null) ]]; then
|
|
log "ERROR: Input files (${TARGET}) not found"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -x ${COMMAND} ]]; then
|
|
VERSION=1.16.7
|
|
log "Downloading 'typos' v${VERSION}"
|
|
wget --progress=dot:mega "https://github.com/crate-ci/typos/releases/download/v${VERSION}/typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz"
|
|
mkdir -p ${_INSTALL_DIR}
|
|
tar -xzvf typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz -C ${_INSTALL_DIR} ./${CMD_NAME}
|
|
rm typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz
|
|
fi
|
|
log "jq: $(jq --version)"
|
|
|
|
ARGS="${TARGET}"
|
|
|
|
# Ignore implicit configuration files
|
|
if [ "${INPUT_ISOLATED:-false}" == "true" ]; then
|
|
ARGS+=" --isolated"
|
|
fi
|
|
|
|
# Write changes to the repository
|
|
if [ "${INPUT_WRITE_CHANGES:-false}" == "true" ]; then
|
|
ARGS+=" --write-changes"
|
|
fi
|
|
|
|
# Use a custom configuration file
|
|
if [[ -n "${INPUT_CONFIG:-}" ]]; then
|
|
ARGS+=" --config ${INPUT_CONFIG}"
|
|
fi
|
|
|
|
log "$ ${COMMAND} ${ARGS}"
|
|
${COMMAND} ${ARGS} --format json | ${SOURCE_DIR}/format_gh.sh || true
|
|
${COMMAND} ${ARGS}
|