Allow black's Github action params overriding. (#1755)

* Allow default params overriding.

* Update: docs and action.yaml.

* The second contirbution, add my name to authors.md

* Correct docs `with.args` example.

* Just to rerun the Travis jobs.

* chmod 755
This commit is contained in:
Hadi Alqattan 2020-10-19 00:24:33 +03:00 committed by GitHub
parent f311d82569
commit 4d6a84a829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 3 deletions

View File

@ -574,6 +574,7 @@ Multiple contributions by:
- [Gregory P. Smith](mailto:greg@krypto.org) - [Gregory P. Smith](mailto:greg@krypto.org)
- Gustavo Camargo - Gustavo Camargo
- hauntsaninja - hauntsaninja
- [Hadi Alqattan](mailto:alqattanhadizaki@gmail.com)
- [Heaford](mailto:dan@heaford.com) - [Heaford](mailto:dan@heaford.com)
- [Hugo Barrera](mailto::hugo@barrera.io) - [Hugo Barrera](mailto::hugo@barrera.io)
- Hugo van Kemenade - Hugo van Kemenade

View File

@ -6,4 +6,4 @@ branding:
icon: "check-circle" icon: "check-circle"
runs: runs:
using: "docker" using: "docker"
image: "Dockerfile" image: "action/Dockerfile"

View File

@ -5,4 +5,6 @@ ENV PYTHONUNBUFFERED 1
RUN pip install --upgrade --no-cache-dir black RUN pip install --upgrade --no-cache-dir black
ENTRYPOINT /usr/local/bin/black --check --diff . COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

10
action/entrypoint.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
if [ $# -eq 0 ]; then
# Default (if no args provided).
sh -c "black . --check --diff"
else
# Custom args.
sh -c "black $*"
fi

View File

@ -69,6 +69,7 @@ Multiple contributions by:
- [Gregory P. Smith](mailto:greg@krypto.org) - [Gregory P. Smith](mailto:greg@krypto.org)
- Gustavo Camargo - Gustavo Camargo
- hauntsaninja - hauntsaninja
- [Hadi Alqattan](mailto:alqattanhadizaki@gmail.com)
- [Heaford](mailto:dan@heaford.com) - [Heaford](mailto:dan@heaford.com)
- [Hugo Barrera](mailto::hugo@barrera.io) - [Hugo Barrera](mailto::hugo@barrera.io)
- Hugo van Kemenade - Hugo van Kemenade

View File

@ -15,5 +15,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
- uses: psf/black@stable - uses: psf/black@stable # the default is equivalent to `black . --diff --check`.
with: # (optional - override the default parameters).
args: ". --diff --check"
``` ```