A gradle plugin that leaves comment of the result of a "KtLint" on github's pull request.
- Gradle 4.6+
- Kotlin 1.2.51+
plugins {
id "com.github.unchai.ktlint-github" version "0.0.1"
}
ktlintGithub {
ghEndpoint = "https://api.github.com"
ghRepository = "owner/repo"
}
$ gradlew ktlintGithub \
--githubOAuth=<github oauth token> \
--githubPullRequest=<pull request id>
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}"
}
}
}
}
Apache License 2.0 © 2018 unchai