From: Hadi Alqattan Date: Sun, 18 Oct 2020 21:24:33 +0000 (+0300) Subject: Allow black's Github action params overriding. (#1755) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/4d6a84a8294d035747404d00b88a925fc2640e1e 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 --- diff --git a/README.md b/README.md index 2ca76dd..7cd4d7f 100644 --- a/README.md +++ b/README.md @@ -574,6 +574,7 @@ Multiple contributions by: - [Gregory P. Smith](mailto:greg@krypto.org) - Gustavo Camargo - hauntsaninja +- [Hadi Alqattan](mailto:alqattanhadizaki@gmail.com) - [Heaford](mailto:dan@heaford.com) - [Hugo Barrera](mailto::hugo@barrera.io) - Hugo van Kemenade diff --git a/action.yml b/action.yml index 2ce1c0b..60bf369 100644 --- a/action.yml +++ b/action.yml @@ -6,4 +6,4 @@ branding: icon: "check-circle" runs: using: "docker" - image: "Dockerfile" + image: "action/Dockerfile" diff --git a/Dockerfile b/action/Dockerfile similarity index 64% rename from Dockerfile rename to action/Dockerfile index a03d23a..eb22099 100644 --- a/Dockerfile +++ b/action/Dockerfile @@ -5,4 +5,6 @@ ENV PYTHONUNBUFFERED 1 RUN pip install --upgrade --no-cache-dir black -ENTRYPOINT /usr/local/bin/black --check --diff . +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action/entrypoint.sh b/action/entrypoint.sh new file mode 100755 index 0000000..dc86fa1 --- /dev/null +++ b/action/entrypoint.sh @@ -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 diff --git a/docs/authors.md b/docs/authors.md index a5349b4..ebf64ea 100644 --- a/docs/authors.md +++ b/docs/authors.md @@ -69,6 +69,7 @@ Multiple contributions by: - [Gregory P. Smith](mailto:greg@krypto.org) - Gustavo Camargo - hauntsaninja +- [Hadi Alqattan](mailto:alqattanhadizaki@gmail.com) - [Heaford](mailto:dan@heaford.com) - [Hugo Barrera](mailto::hugo@barrera.io) - Hugo van Kemenade diff --git a/docs/github_actions.md b/docs/github_actions.md index 7ff8754..ac80c2f 100644 --- a/docs/github_actions.md +++ b/docs/github_actions.md @@ -15,5 +15,7 @@ jobs: steps: - uses: actions/checkout@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" ```