Skip to content

Commit

Permalink
Merge branch 'master' into dvd/always-latest-version
Browse files Browse the repository at this point in the history
  • Loading branch information
DVDAndroid authored Jul 14, 2020
2 parents ffaa4a9 + 30abd3a commit 735b27f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ The default is `github-pr-check`.
Optional. Fails the current check if any error was found [`true`/`false`]
The default value is false.

### `relative`

Optional. Print files relative to the working directory [`true`/`false`]
The default value is false.

### `android`

Optional. Runs KtLint with [Android Kotlin Style Guide](https://android.github.io/kotlin-guides/style.html) [`true`/`false`]
The default value is false.

## Example usage

```yml
Expand Down
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ inputs:
Default is false.
required: false
default: 'false'
relative:
description: Print files relative to the working directory
required: false
default: 'false'
android:
description: Run KtLint with Android Kotlin Style Guide
required: false
default: 'false'
runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -30,6 +38,8 @@ runs:
- ${{ inputs.level }}
- ${{ inputs.reporter }}
- ${{ inputs.fail_on_error }}
- ${{ inputs.relative }}
- ${{ inputs.android }}
branding:
icon: 'edit'
color: 'blue'
13 changes: 12 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
#!/bin/sh

export RELATIVE=
export ANDROID=

if [ "$INPUT_FAIL_ON_ERROR" = true ] ; then
set -o pipefail
fi

if [ "$INPUT_RELATIVE" = true ] ; then
export RELATIVE=--relative
fi

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

cd "$GITHUB_WORKSPACE"

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

echo KtLint version: "$(ktlint --version)"
ktlint --reporter=checkstyle \
ktlint --reporter=checkstyle $RELATIVE $ANDROID \
| reviewdog -f=checkstyle -name="ktlint" -reporter="${INPUT_REPORTER}" -level="${INPUT_LEVEL}"

0 comments on commit 735b27f

Please sign in to comment.