]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Release gh action (#1909)
authorRick Staa <rick.staa@outlook.com>
Fri, 8 Jan 2021 19:47:03 +0000 (20:47 +0100)
committerGitHub <noreply@github.com>
Fri, 8 Jan 2021 19:47:03 +0000 (11:47 -0800)
* 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>
README.md
action.yml
action/entrypoint.sh

index a557a6fc6c8fd9628ca2ebdb668ca5622e819361..269bf5aaa43260d7f91fe7eb75d5beba370cd829 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
index 60bf369a3d812192ef023c0cdb7b1c45d8af6d18..59b16a9fb6cc6916c9f4df58d03d79de17084dcd 100644 (file)
@@ -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"
index dc86fa1996e4c7dbaeb804f4cd39788dc8a36e4c..92501f79db8107d8ce7756800b00c4e314a5a7c2 100755 (executable)
@@ -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[*]}"