Skip to content

Commit

Permalink
Produce pretty lint results in GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ypcs committed Jun 18, 2024
1 parent b83f878 commit fca6a19
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ build:
$(DOCKER) build -t $(IMAGE) .

run:
$(DOCKER) run --rm -it $(IMAGE)
$(DOCKER) run --rm -it $(IMAGE) --help

run-cli:
$(DOCKER) run --rm -it --entrypoint bash $(IMAGE)
12 changes: 12 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -e

# Execute PHPCS

# If we're running in GitHub Actions, do some formatting
if [ -n "${GITHUB_ACTIONS}" ]
then
/usr/bin/php /usr/local/bin/phpcs -q --report=checkstyle "$@" |/usr/local/bin/cs2pr
else
/usr/bin/php /usr/local/bin/phpcs "$@"
fi

0 comments on commit fca6a19

Please sign in to comment.