RepositoryAction repositoryAction = run.getAction(RepositoryAction.class);
if( repositoryAction != null ) {
if( repositoryAction instanceof ProjectRepositoryAction ) {
final ProjectRepositoryAction projectRepositoryAction = (ProjectRepositoryAction) repositoryAction;
AbstractProject item = (AbstractProject)Hudson.getInstance().getItem(projectRepositoryAction.getProjectName());
Optional<Run> r = Iterables.tryFind(item.getBuilds(), new Predicate<Run>() {
public boolean apply(Run run) {
return run.getNumber() == projectRepositoryAction.getBuildNumber();
}
});
if( r.isPresent() )
traverseChain(visitor, r.get());