Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Add support for pull_request_review type and added PR pagination
  • Loading branch information
potiuk committed Oct 28, 2020
1 parent e3ba776 commit a0fc88cf92cadf7145ec723e7f93ab64eb9b96fc
Showing 2 changed files with 17 additions and 11 deletions.
@@ -1486,12 +1486,12 @@ function findPullRequest(octokit, owner, repo, headRepo, headBranch, headSha) {
return __awaiter(this, void 0, void 0, function* () {
// Finds Pull request for this workflow run
core.info(`\nFinding PR request id for: owner: ${owner}, Repo:${repo}, Head:${headRepo}:${headBranch}.\n`);
const pullRequests = yield octokit.pulls.list({
const pullRequests = yield octokit.paginate(octokit.pulls.list({
owner,
repo,
head: `${headRepo}:${headBranch}`
});
for (const pullRequest of pullRequests.data) {
}));
for (const pullRequest of pullRequests) {
core.info(`\nComparing: ${pullRequest.number} sha: ${pullRequest.head.sha} with expected: ${headSha}.\n`);
if (pullRequest.head.sha === headSha) {
core.info(`\nFound PR: ${pullRequest.number}\n`);
@@ -1515,7 +1515,8 @@ function getOrigin(octokit, runId, owner, repo) {
`Head branch: ${sourceRun.head_branch} ` +
`Event: ${sourceRun.event}, Head sha: ${sourceRun.head_sha}, url: ${sourceRun.url}`);
let pullRequest = null;
if (sourceRun.event === 'pull_request') {
if (sourceRun.event === 'pull_request' ||
sourceRun.event === 'pull_request_review') {
pullRequest = yield findPullRequest(octokit, owner, repo, sourceRun.head_repository.owner.login, sourceRun.head_branch, sourceRun.head_sha);
}
return [
@@ -43,12 +43,14 @@ async function findPullRequest(
core.info(
`\nFinding PR request id for: owner: ${owner}, Repo:${repo}, Head:${headRepo}:${headBranch}.\n`
)
const pullRequests = await octokit.pulls.list({
owner,
repo,
head: `${headRepo}:${headBranch}`
})
for (const pullRequest of pullRequests.data) {
const pullRequests = await octokit.paginate(
octokit.pulls.list({
owner,
repo,
head: `${headRepo}:${headBranch}`
})
)
for (const pullRequest of pullRequests) {
core.info(
`\nComparing: ${pullRequest.number} sha: ${pullRequest.head.sha} with expected: ${headSha}.\n`
)
@@ -82,7 +84,10 @@ async function getOrigin(
`Event: ${sourceRun.event}, Head sha: ${sourceRun.head_sha}, url: ${sourceRun.url}`
)
let pullRequest: rest.PullsListResponseItem | null = null
if (sourceRun.event === 'pull_request') {
if (
sourceRun.event === 'pull_request' ||
sourceRun.event === 'pull_request_review'
) {
pullRequest = await findPullRequest(
octokit,
owner,

0 comments on commit a0fc88c

Please sign in to comment.