black/action/entrypoint.sh
Rick Staa ba3648d984
Release gh action (#1909)
* Gets gh-action ready for marketplace release

* Updates documentation and removes redundant gh-action input argument

* Fixes gh-action bug

This commit fixes a bug which caused not all input arguments were forwarder to the black formatter.

* Update README.md

Co-authored-by: Cooper Lees <me@cooperlees.com>

Co-authored-by: Cooper Lees <me@cooperlees.com>
2021-01-08 11:47:03 -08:00

18 lines
480 B
Bash
Executable File

#!/bin/sh
set -e
# If no arguments are given use current working directory
black_args=(".")
if [ "$#" -eq 0 ] && [ "${INPUT_BLACK_ARGS}" != "" ]; then
black_args+=(${INPUT_BLACK_ARGS})
elif [ "$#" -ne 0 ] && [ "${INPUT_BLACK_ARGS}" != "" ]; then
black_args+=($* ${INPUT_BLACK_ARGS})
elif [ "$#" -ne 0 ] && [ "${INPUT_BLACK_ARGS}" == "" ]; then
black_args+=($*)
else
# Default (if no args provided).
black_args+=("--check" "--diff")
fi
sh -c "black . ${black_args[*]}"