Skip to content

Commit

Permalink
add properties_file option
Browse files Browse the repository at this point in the history
# Conflicts:
#	action.yml
#	entrypoint.sh
  • Loading branch information
tochi-y authored and dbelyaev committed Jul 28, 2023
1 parent ca57ba1 commit a91e58c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ An example of how the reported Checkstyle violations will look on a pull request

![PR comment with violation](https://user-images.githubusercontent.com/6915328/149333188-4600a75d-5670-4013-9395-d5852e3c7839.png)


## Usage

```yaml
Expand Down Expand Up @@ -116,3 +115,9 @@ config for the [Sun coding conventions](https://www.oracle.com/java/technologies
Additional reviewdog flags.

**`Default:`** ``

* ### `properties_file`

Properties file relative to the root directory.

**`Default:`** ``
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ inputs:
This field will always try to follow Checkstyle releases as close as possible and will use the latest available by default.
If it is not a default preference for your project, please, pin the needed version using this property.
default: "10.12.1"
properties_file:
description: |
Properties file relative to the root directory.
default: ''
runs:
using: "docker"
image: "Dockerfile"
Expand Down
9 changes: 8 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#!/bin/sh

echo "Running check"

set -e

if [ -n "${GITHUB_WORKSPACE}" ] ; then
cd "${GITHUB_WORKSPACE}" || exit
fi

if [ -n "${INPUT_PROPERTIES_FILE}" ]; then
OPT_PROPERTIES_FILE="-p ${INPUT_PROPERTIES_FILE}"
fi

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

printenv
Expand All @@ -13,7 +20,7 @@ ls
# fetch checkstyle of a requested version
wget -O - -q "https://github.com/checkstyle/checkstyle/releases/download/checkstyle-${INPUT_CHECKSTYLE_VERSION}/checkstyle-${INPUT_CHECKSTYLE_VERSION}-all.jar" > /checkstyle.jar

exec java -jar /checkstyle.jar -c "${INPUT_CHECKSTYLE_CONFIG}" "${INPUT_WORKDIR}" -f xml \
exec java -jar /checkstyle.jar "${INPUT_WORKDIR}" -c "${INPUT_CHECKSTYLE_CONFIG}" "${INPUT_WORKDIR}" ${OPT_PROPERTIES_FILE} -f xml \
| reviewdog -f=checkstyle \
-name="checkstyle" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
Expand Down

0 comments on commit a91e58c

Please sign in to comment.