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>
This commit is contained in:
parent
966baaacbc
commit
ba3648d984
@ -411,8 +411,16 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: psf/black@stable
|
||||
with:
|
||||
black_args: ". --check"
|
||||
```
|
||||
|
||||
### Inputs
|
||||
|
||||
#### `black_args`
|
||||
|
||||
**optional**: Black input arguments. Defaults to `. --check --diff`.
|
||||
|
||||
## Ignoring unmodified files
|
||||
|
||||
_Black_ remembers files it has already formatted, unless the `--diff` flag is used or
|
||||
|
@ -1,6 +1,11 @@
|
||||
name: "Black"
|
||||
description: "The uncompromising Python code formatter."
|
||||
author: "Łukasz Langa and contributors to Black"
|
||||
inputs:
|
||||
black_args:
|
||||
description: "Black input arguments."
|
||||
required: false
|
||||
default: ""
|
||||
branding:
|
||||
color: "black"
|
||||
icon: "check-circle"
|
||||
|
@ -1,10 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
# Default (if no args provided).
|
||||
sh -c "black . --check --diff"
|
||||
# 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
|
||||
# Custom args.
|
||||
sh -c "black $*"
|
||||
# Default (if no args provided).
|
||||
black_args+=("--check" "--diff")
|
||||
fi
|
||||
|
||||
sh -c "black . ${black_args[*]}"
|
||||
|
Loading…
Reference in New Issue
Block a user