Skip to content

Commit

Permalink
fix: migrate to 0.49.0 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
berhram authored Apr 27, 2023
1 parent 4d5f4b5 commit cc99a1f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ if [ ! -z "$INPUT_BASELINE" ]; then
export BASELINE="--baseline=${INPUT_BASELINE}"
fi

if [ "$INPUT_ANDROID" = true ]; then
export ANDROID=--android
fi

if [ "$INPUT_CUSTOM_RULE_PATH" ]; then
export CUSTOM_RULE_PATH="--ruleset=${INPUT_CUSTOM_RULE_PATH}"
fi
Expand All @@ -41,7 +37,20 @@ git config --global --add safe.directory $GITHUB_WORKSPACE

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

echo ktlint version: "$(ktlint --version)"
ktlint_version=$(ktlint --version)
echo "ktlint version: $ktlint_version"

if [ "$(printf '%s\n' "0.49.0" "$ktlint_version" | sort -V | head -n1)" = "0.49.0" ]; then
if [ "$INPUT_ANDROID" = true ]; then
export ANDROID="--code-style=android_studio"
else
export ANDROID="--code-style=intellij_idea"
fi
else
if [ "$INPUT_ANDROID" = true ]; then
export ANDROID=--android
fi
fi

ktlint --reporter=checkstyle $CUSTOM_RULE_PATH $RELATIVE $ANDROID $BASELINE $INPUT_FILE_GLOB |
reviewdog -f=checkstyle \
Expand All @@ -50,3 +59,4 @@ ktlint --reporter=checkstyle $CUSTOM_RULE_PATH $RELATIVE $ANDROID $BASELINE $INP
-level="${INPUT_LEVEL}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}"

0 comments on commit cc99a1f

Please sign in to comment.