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 74f28a6
Show file tree
Hide file tree
Showing 3 changed files with 20 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"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ build:
$(DOCKER) build -t $(IMAGE) .

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

17 changes: 17 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
set -e

EXTRA_ARGS=""
EXTRA_PIPE=""

#
# If we're running in GitHub Actions, do some formatting
#
if [ -n "${GITHUB_ACTIONS}" ]
then
EXTRA_ARGS="--report=checkstyle"
EXTRA_PIPE="| cs2pr"
fi

# Execute PHPCS
/usr/bin/php /usr/local/bin/phpcs ${EXTRA_ARGS} "$@" ${EXTRA_PIPE}

0 comments on commit 74f28a6

Please sign in to comment.