Examples of GHRepository


Examples of org.kohsuke.github.GHRepository

public class GithubReposControllerTest {

    @Test
    public void should_show_repos_with_admin_access_only() {
        final GithubCurrentUserService githubCurrentUser = mock(GithubCurrentUserService.class);
        GHRepository repoWithAdminAccess = mock(GHRepository.class);
        when(repoWithAdminAccess.hasAdminAccess()).thenReturn(true);
        when(githubCurrentUser.getRepositories("meow")).thenReturn(map("one", mock(GHRepository.class), "two", repoWithAdminAccess));
        GithubReposController controller = new GithubReposController() {
            @Override
            protected GithubCurrentUserService getCurrentUser() {
                return githubCurrentUser;
View Full Code Here

Examples of org.kohsuke.github.GHRepository

        String sha1 = build.getSha();
        if (sha1 == null) {
            return ;
        }

        GHRepository repository = getGithubRepository(build);
        GHCommitState state;
        String msg;
        Result result = build.getResult();
        if (result.isBetterOrEqualTo(SUCCESS)) {
            state = GHCommitState.SUCCESS;
            msg = "Success";
        } else if (result.isBetterOrEqualTo(UNSTABLE)) {
            state = GHCommitState.FAILURE;
            msg = "Unstable";
        } else {
            state = GHCommitState.FAILURE;
            msg = "Failed";
        }
        try {
            repository.createCommitStatus(sha1, state, build.getFullUrl(), msg,"DotCi");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        listener.getLogger().println("setting commit status on Github for " + repository.getUrl() + "/commit/" + sha1);

    }
View Full Code Here

Examples of org.kohsuke.github.GHRepository

    private static final Logger LOGGER = Logger.getLogger(CommitStatusUpdateListener.class.getName());

    @Override
    public void onStarted(DynamicBuild build, TaskListener listener) {
        GHRepository repository = getGithubRepository(build);

        try {
            String url = "";
            try {
                url = build.getFullUrl();
            } catch (Exception e) {
                // do nothing
                // TODO DO SOMETHING
            }
            repository.createCommitStatus(build.getSha(), GHCommitState.PENDING, url, "Build in progress");
        } catch (IOException e) {
            // Ignore if cannot create a pending status
            LOGGER.log(Level.WARNING, "Failed to Update commit status", e);
        }
    }
View Full Code Here

Examples of org.kohsuke.github.GHRepository

    }

    public  Iterable<String> getBranches() throws IOException {
        ArrayList<String> branches  = new ArrayList<String>();
        GHRepository githubRepo = getGhRepository();
        branches.addAll(githubRepo.getBranches().keySet());
        branches.add("Pull Request: ");
        return branches;
    }
View Full Code Here

Examples of org.kohsuke.github.GHRepository

    try {
      if (annotation == null) {
        return Status.NOT_TRACKING;
      }
      GitHub gitHub = GitHub.connect();
      GHRepository repository = gitHub.getRepository(annotation.repository());
      GHIssue issue = repository.getIssue(annotation.issue());
      if (issue != null && issue.getState() == GHIssueState.OPEN) {
        return Status.OPEN;
      } else {
        return Status.CLOSED;
      }
View Full Code Here

Examples of org.kohsuke.github.GHRepository

        return new Iterable<GHRepository>() {
            public Iterator<GHRepository> iterator() {
                return filterNull(new AdaptedIterator<GitHub,GHRepository>(GitHubWebHook.get().login(host,userName)) {
                    protected GHRepository adapt(GitHub item) {
                        try {
                            GHRepository repo = item.getUser(userName).getRepository(repositoryName);
                            if (repo == null) {
                                repo = item.getOrganization(userName).getRepository(repositoryName);
                            }
                            return repo;
                        } catch (IOException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.