├── Dockerfile ├── LICENSE ├── README.md └── action.yml /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:jre-slim 2 | 3 | ADD https://github.com/pinterest/ktlint/releases/download/0.46.1/ktlint /usr/local/bin/ktlint 4 | RUN chmod +x /usr/local/bin/ktlint 5 | 6 | ENTRYPOINT ["ktlint"] 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Vincent Roy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Action Kotlin Linter 2 | 3 | This GitHub action runs the Kotlin Linter, [ktlint](https://github.com/pinterest/ktlint). 4 | 5 | ## Inputs 6 | 7 | ### `patterns` 8 | 9 | **Optional** A list of patterns to pass along to the `ktlint` command. Default: `**/*.kt` 10 | 11 | ## Example usage 12 | 13 | ``` 14 | name: ktlint 15 | 16 | on: 17 | pull_request: 18 | paths: 19 | - "**/*.kt" 20 | - ".github/workflows/ktlint.yml" 21 | 22 | jobs: 23 | ktlint: 24 | runs-on: ubuntu-latest 25 | 26 | steps: 27 | - name: "checkout" 28 | uses: actions/checkout@v2 29 | 30 | - name: "ktlint" 31 | uses: "vroy/gha-kotlin-linter@v1" 32 | ``` 33 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Kotlin Linter' 2 | description: 'Run ktlint in your repository' 3 | inputs: 4 | patterns: 5 | description: 'A list of patterns to pass along to the ktlint command' 6 | default: '**/*.kt' 7 | runs: 8 | using: 'docker' 9 | image: 'Dockerfile' 10 | args: 11 | - ${{ inputs.patterns }} 12 | branding: 13 | icon: eye 14 | color: purple 15 | --------------------------------------------------------------------------------