private void updateBuildStatus(@NotNull final SRunningBuild build, boolean isStarting) { SBuildType bt = build.getBuildType(); if (bt == null) return; for (SBuildFeatureDescriptor feature : bt.getBuildFeatures()) { if (!feature.getType().equals(UpdateChangeStatusFeature.FEATURE_TYPE)) continue; final Handler h = myUpdater.getUpdateHandler(feature); final Collection<BuildRevision> changes = getLatestChangesHash(build); if (changes.isEmpty()) { LOG.warn( "No revisions were found to update GitHub status. Please check you have Git VCS roots in the build configuration"); } for (BuildRevision e : changes) { if (isStarting) { h.scheduleChangeStarted(e.getRepositoryVersion(), build); } else { h.scheduleChangeCompeted(e.getRepositoryVersion(), build); } } } }
@NotNull private Collection<BuildRevision> getLatestChangesHash(@NotNull final SRunningBuild build) { final Collection<BuildRevision> result = new ArrayList<BuildRevision>(); for (BuildRevision rev : build.getRevisions()) { if (!"jetbrains.git".equals(rev.getRoot().getVcsName())) continue; LOG.debug( "Found revision to report status to GitHub: " + rev.getRevision() + ", branch: " + rev.getRepositoryVersion().getVcsBranch() + " from root " + rev.getRoot().getName()); result.add(rev); } return result; }