in commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/github/ChangeStatusUpdater.java [310:333]
protected String resolveCommitHash(RepositoryVersion myVersion, Repository repo, GitHubChangeState myTargetStatus, String buildIdentificator, @Nullable AtomicBoolean shouldRetry) {
final String vcsBranch = myVersion.getVcsBranch();
if (vcsBranch != null && myApi.isPullRequestMergeBranch(vcsBranch)) {
try {
final String hash = myApi.findPullRequestCommit(repo.owner(), repo.repositoryName(), vcsBranch);
if (hash == null) {
throw new IOException("Failed to find head hash for commit from " + vcsBranch);
}
LOG.debug("Resolved GitHub change commit for " + vcsBranch + " to point to pull request head for " +
"hash: " + myVersion.getVersion() + ", " +
"newHash: " + hash + ", " +
"branch: " + myVersion.getVcsBranch() + ", " +
"status: " + myTargetStatus + ", " +
buildIdentificator);
return hash;
} catch (Exception e) {
if (shouldRetry != null && e instanceof PublisherException && ((PublisherException)e).shouldRetry()) {
shouldRetry.set(true);
}
LOG.warn("Failed to find status update hash for " + vcsBranch + " for repository " + repo.repositoryName());
}
}
return myVersion.getVersion();
}