Skip to content

Commit

Permalink
Merge pull request #111 from linkorb/fix-reviewdog-pr-runtime-9082
Browse files Browse the repository at this point in the history
fix: PR reviewdog runtime #9082
  • Loading branch information
mhitza authored Dec 11, 2024
2 parents 6bfcd0e + a47de56 commit 9e4e736
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docker/reviewdog/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM php:8.4

RUN apt-get -y update && apt-get install -y ansible wget
RUN apt-get -y update && apt-get install -y ansible wget git

ARG phpstan_version=2.0.1
RUN wget "https://github.com/phpstan/phpstan/releases/download/$phpstan_version/phpstan.phar" \
Expand Down
18 changes: 12 additions & 6 deletions docker/reviewdog/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,31 @@
help=$(cat <<'EOQ'
all - run checks for all files (DEFAULT)
pull-request - run checks for the latest changes (based on diff and pull request branch) - for CI use
bash - run bash instead
... - all other unknown arguments are passed to reviewdog
EOQ
)

fix=0
reviewdog_args='-filter-mode=nofilter'
cmd="reviewdog"
reviewdog_args=('-filter-mode=nofilter')

for arg in "$@"; do
if [ "$arg" = "help" ]; then
echo "$help"; exit 0;
elif [ "$arg" = "fix" ]; then
fix=1
elif [ "$arg" = "bash" ]; then
cmd=bash
reviewdog_args=()
elif [ "$arg" = "pull-request" ]; then
reviewdog_args='-diff="git diff FETCH_HEAD" -reporter=github-pr-check'
reviewdog_args=("-diff=git diff FETCH_HEAD")
reviewdog_args+=("-reporter=github-pr-check")
else
reviewdog_args="$reviewdog_args $arg"
reviewdog_args+=("$arg")
fi
done

reviewdog_args="$reviewdog_args"
echo reviewdog $reviewdog_args >&2
exec reviewdog $reviewdog_args
git config --global --add safe.directory /app
echo $cmd "${reviewdog_args[@]}" >&2
exec $cmd "${reviewdog_args[@]}"

0 comments on commit 9e4e736

Please sign in to comment.