Skip to content

A gradle plugin that leaves comment of the result of a "KtLint" on github's pull request.

License

Notifications You must be signed in to change notification settings

unchai/ktlint-github-gradle-plugin

Repository files navigation

ktlint-github-gradle-plugin

Build Status

A gradle plugin that leaves comment of the result of a "KtLint" on github's pull request.

Example

Requirements

  • Gradle 4.6+
  • Kotlin 1.2.51+

Install

plugins {
  id "com.github.unchai.ktlint-github" version "0.0.1"
}

ktlintGithub {
  ghEndpoint = "https://api.github.com"
  ghRepository = "owner/repo"
}

Usage

$ gradlew ktlintGithub \
    --githubOAuth=<github oauth token> \
    --githubPullRequest=<pull request id>

with Jenkinsfile

node {
    stage('lint') {
        if (env.CHANGE_ID) {
            withCredentials([[$class: 'StringBinding', credentialsId: 'github-bot', variable: 'GITHUB_ACCESS_TOKEN']]) {
                sh "'${pwd()}/gradlew' ktlintGithub" +
                   " --githubOAuth=${GITHUB_ACCESS_TOKEN}" +
                   " --githubPullRequest=${env.CHANGE_ID}"
            }
        }
    }
}

License

Apache License 2.0 © 2018 unchai

About

A gradle plugin that leaves comment of the result of a "KtLint" on github's pull request.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages