Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply patches and fixes from similar actions #31

Merged
merged 4 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
15 changes: 12 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
#!/bin/sh

command -v reviewdog >/dev/null 2>&1 || { echo >&2 "reviewdog: not found"; exit 1; }

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
ls

# fetch checkstyle of a requested version
echo "Download Checkstyle v${INPUT_CHECKSTYLE_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 \
echo "Run Checkstyle check"
exec java -jar /checkstyle.jar "${INPUT_WORKDIR}" -c "${INPUT_CHECKSTYLE_CONFIG}" ${OPT_PROPERTIES_FILE} -f xml \
dbelyaev marked this conversation as resolved.
Show resolved Hide resolved
dbelyaev marked this conversation as resolved.
Show resolved Hide resolved
| reviewdog -f=checkstyle \
-name="checkstyle" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-filter-mode="${INPUT_FILTER_MODE:-added}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR:-false}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS}
dbelyaev marked this conversation as resolved.
Show resolved Hide resolved
dbelyaev marked this conversation as resolved.
Show resolved Hide resolved
Loading