@Test(dependsOnMethods = "testStoreUpdate") public void testAsUser() throws Exception { GHRepository repo = github.getOrganization(ORG).getRepository(NAME); List<GHPullRequest> prs = repo.getPullRequests(GHIssueState.OPEN); Assert.assertTrue(prs.size() == 1); for (GHPullRequest pr : prs) { pr.merge("Automatic merge through itests."); pr.close(); } try (InputStream stream = repo.getFileContent("Dockerfile").read(); InputStreamReader streamR = new InputStreamReader(stream); BufferedReader reader = new BufferedReader(streamR)) { String line; while ((line = reader.readLine()) != null) { if (line.contains("FROM")) { Assert.assertTrue(line.contains(IMAGE)); Assert.assertTrue(line.endsWith(TAG)); } } } }
/** * Forks this repository into an organization. * * @return * Newly forked repository that belong to you. */ public GHRepository forkTo(GHOrganization org) throws IOException { new Requester(root).to(getApiTailUrl("forks?org="+org.getLogin())); // this API is asynchronous. we need to wait for a bit for (int i=0; i<10; i++) { GHRepository r = org.getRepository(name); if (r!=null) return r; try { Thread.sleep(3000); } catch (InterruptedException e) { throw (IOException)new InterruptedIOException().initCause(e); } } throw new IOException(this+" was forked into "+org.getLogin()+" but can't find the new repository"); }
/** * Forks this repository into an organization. * * @return * Newly forked repository that belong to you. */ public GHRepository forkTo(GHOrganization org) throws IOException { new Requester(root).to(getApiTailUrl("forks?org="+org.getLogin())); // this API is asynchronous. we need to wait for a bit for (int i=0; i<10; i++) { GHRepository r = org.getRepository(name); if (r!=null) return r; try { Thread.sleep(3000); } catch (InterruptedException e) { throw (IOException)new InterruptedIOException().initCause(e); } } throw new IOException(this+" was forked into "+org.getLogin()+" but can't find the new repository"); }
GitHub github = GitHub.connectUsingPassword(userName, password); GHOrganization alibaba = github.getOrganization("Alibaba"); GHRepository rep = alibaba.getRepository("RocketMQ");
/** * Forks this repository into an organization. * * @return * Newly forked repository that belong to you. */ public GHRepository forkTo(GHOrganization org) throws IOException { new Requester(root).to(getApiTailUrl("forks?org="+org.getLogin())); // this API is asynchronous. we need to wait for a bit for (int i=0; i<10; i++) { GHRepository r = org.getRepository(name); if (r!=null) return r; try { Thread.sleep(3000); } catch (InterruptedException e) { throw (IOException)new InterruptedIOException().initCause(e); } } throw new IOException(this+" was forked into "+org.getLogin()+" but can't find the new repository"); }
listener.getLogger() .format("Looking up %s repository of organization %s%n%n", sourceName, repoOwner); GHRepository repo = org.getRepository(sourceName); if (repo != null) { if (request.process(repo.getName(), sourceFactory, null, witness)) {