GHCommitStatus status = iterator.next(); GHCommitState state = status.getState(); String key = status.getTargetUrl(); if (key == null) { continue;
public void createOrUpdateSonarQubeStatus(GHCommitState status, String statusDescription) { try { // Copy previous targetUrl in case it was set by an external system (like the CI job). String targetUrl = null; GHCommitStatus lastStatus = getCommitStatusForContext(pr, COMMIT_CONTEXT); if (lastStatus != null) { targetUrl = lastStatus.getTargetUrl(); } ghRepo.createCommitStatus(pr.getHead().getSha(), status, targetUrl, statusDescription, COMMIT_CONTEXT); } catch (FileNotFoundException e) { String msg = "Unable to set pull request status. GitHub account probably miss push permission on the repository."; if (LOG.isDebugEnabled()) { LOG.warn(msg, e); } else { LOG.warn(msg); } } catch (IOException e) { throw new IllegalStateException("Unable to update commit status", e); } }