in commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/github/GitHubPublisher.java [143:180]
private Event getTriggeredEvent(CommitStatus commitStatus) {
if (commitStatus.state == null) {
LOG.warn("No GitHub build status is provided. Related event can not be calculated");
return null;
}
GitHubChangeState gitHubChangeState = GitHubChangeState.getByState(commitStatus.state);
if (gitHubChangeState == null) {
LOG.warn("Unknown GitHub build status \"" + commitStatus.state + "\". Related event can not be calculated");
return null;
}
String description = commitStatus.description;
switch (gitHubChangeState) {
case Pending:
if (description == null) {
LOG.info("Can not define exact event for \"Pending\" GitHub build status, because there is no description for status");
return null;
}
if (description.contains(DefaultStatusMessages.BUILD_STARTED)) {
return Event.STARTED;
} else if (description.contains(DefaultStatusMessages.BUILD_QUEUED)) {
return Event.QUEUED;
}
LOG.warn("Can not define event for \"Pending\" Github build status and description: \"" + description + "\"");
break;
case Success:
case Error:
return null;
case Failure:
if (description != null && (description.contains(DefaultStatusMessages.BUILD_REMOVED_FROM_QUEUE) || description.contains(DefaultStatusMessages.BUILD_REMOVED_FROM_QUEUE_AS_CANCELED))) {
return Event.REMOVED_FROM_QUEUE;
} else {
return null;
}
default:
LOG.warn("No event is assosiated with GitHub build status \"" + gitHubChangeState + "\". Related event can not be defined");
}
return null;
}