前提
danger-checkstyle_formatプラグインがgemにしかないのでRuby製のdangerを使用しました
結論
これでイケた
workflow "DangerPullRequest" {
on = "pull_request"
resolves = ["Danger"]
}
action "Detekt" {
uses = "docker://adoptopenjdk/openjdk8:alpine"
runs = "./gradlew"
args = "detekt" ← ktlint or 併用でも適宜読み替えてください
}
action "Danger" {
uses = "u-nation/GithubActions/danger@master"
needs = "Detekt"
secrets = ["GITHUB_TOKEN"]
}
ハマりポイント
-
on = "push"
だとDangerがNot a GitHubActions Pull Request - skipping danger run
エラーを出すのでon = "pull_request"
にするのを忘れない - GithubActionsのでDangerに対応したのは5.10.3から、なのでバージョン指定をちゃんとする
FROM ruby:2.6
LABEL "com.github.actions.name"="Danger"
LABEL "com.github.actions.description"="Run Danger"
LABEL "com.github.actions.icon"="alert-triangle"
LABEL "com.github.actions.color"="yellow"
LABEL "maintainer"="u-nation <Endooooooo7@gmail.com>"
RUN apt-get update -qq && apt-get install -y build-essential p7zip unzip
RUN gem install danger -v '>= 5.10.3' ← これが大事
RUN gem install danger-checkstyle_format
ENTRYPOINT "danger"
CMD "--verbose"