public static void validatePullRequestCreation(GHRepository repo, boolean created) throws Exception { GHRepository parentRepo = repo.getParent(); List<GHPullRequest> prs = parentRepo.getPullRequests(GHIssueState.OPEN); if (created) { assertEquals(prs.size(), 1, "There should only be one pull request."); for (GHPullRequest pr : prs) { // TODO: In sometimes two commits are generated; a blank one followed tag bump. Ideally we'd have one Assertions.assertThat(pr.listCommits().asList().size()).isGreaterThanOrEqualTo(1); } } else { assertEquals(prs.size(), 0, "There should be no pull requests."); } }
private GitUser getPRCommitAuthor() { try { for (GHPullRequestCommitDetail commitDetails : pr.listCommits()) { if (commitDetails.getSha().equals(getHead())) { return commitDetails.getCommit().getCommitter(); } } } catch (Error e) { LOGGER.log(Level.INFO, "Unable to get PR commits: ", e); } catch (Exception ex) { LOGGER.log(Level.INFO, "Unable to get PR commits: ", ex); } return null; }
for (GHPullRequestCommitDetail detail : pr.listCommits()) { Commit commit = detail.getCommit(); GitUser committer = commit.getCommitter();