typos/docker/entrypoint.sh
Vanessasaurus 7d09c5a4bf
feat(ci): adding github action to use typos to check spelling (#267)
Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-05-31 19:42:45 -05:00

59 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
set -e
printf "Found files in workspace:\n"
ls
printf "\nLooking for typos installed...\n"
which typos
COMMAND="typos"
# Show the _typos.toml file
if [ -f "_typos.toml" ]; then
echo "_typos.toml:"
cat _typos.toml
echo
fi
# Ignore implicit configuration files
if [ "${INPUT_ISOLATED}" == "true" ]; then
COMMAND="${COMMAND} --isolated"
fi
# Use a custom configuration file
if [ ! -z "${INPUT_CONFIG}" ]; then
# It must exist
if [ ! -f "${INPUT_CONFIG}" ]; then
printf "${INPUT_CONFIG} does not exist.\n"
exit 1;
else
# Show the custom config to the user
printf "Custom config:\n"
cat "${INPUT_CONFIG}"
echo
fi
COMMAND="${COMMAND} --config ${INPUT_CONFIG}"
fi
# Files are technically optional
if [ ! -z "${INPUT_FILES}" ]; then
COMMAND="${COMMAND} ${INPUT_FILES}"
fi
echo "Command: "
echo "${COMMAND}"
echo
${COMMAND}
retval=$?
if [[ "${retval}" -eq 0 ]]; then
printf "No spelling mistakes found! 🎉️\n"
else
printf "Spelling mistakes found! 😱️\n"
exit $retval;
fi