From 81ef95f1966b9af4732a2440a4a035e01f2223a7 Mon Sep 17 00:00:00 2001 From: Ville Korhonen Date: Tue, 18 Jun 2024 09:25:37 +0300 Subject: [PATCH] Produce pretty lint results in GitHub Actions --- Dockerfile | 3 ++- Makefile | 2 +- entrypoint.sh | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 6f77dc9..1924636 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,4 +25,5 @@ RUN ln -s /usr/share/php/PHP/CodeSniffer/bin/phpcs /usr/local/bin/phpcs && \ USER user -ENTRYPOINT ["/usr/bin/php", "/usr/local/bin/phpcs"] +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/Makefile b/Makefile index 0aef54b..00300f0 100644 --- a/Makefile +++ b/Makefile @@ -7,5 +7,5 @@ build: $(DOCKER) build -t $(IMAGE) . run: - $(DOCKER) run --rm -it $(IMAGE) + $(DOCKER) run --rm -it $(IMAGE) --help diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..f1499b8 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Execute PHPCS + +# If we're running in GitHub Actions, do some formatting +if [ -n "${GITHUB_ACTIONS}" ] + /usr/bin/php /usr/local/bin/phpcs --report=checkstyle "$@" |cs2pr +else + /usr/bin/php /usr/local/bin/phpcs "$@" +fi