String sha1 = build.getSha();
if (sha1 == null) {
return ;
}
GHRepository repository = getGithubRepository(build);
GHCommitState state;
String msg;
Result result = build.getResult();
if (result.isBetterOrEqualTo(SUCCESS)) {
state = GHCommitState.SUCCESS;
msg = "Success";
} else if (result.isBetterOrEqualTo(UNSTABLE)) {
state = GHCommitState.FAILURE;
msg = "Unstable";
} else {
state = GHCommitState.FAILURE;
msg = "Failed";
}
try {
repository.createCommitStatus(sha1, state, build.getFullUrl(), msg,"DotCi");
} catch (IOException e) {
throw new RuntimeException(e);
}
listener.getLogger().println("setting commit status on Github for " + repository.getUrl() + "/commit/" + sha1);
}