This repository has been archived by the owner on Feb 11, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(status-event): enabled processing to be triggered by a status-event
hoping that use of the status-event can replace the use of the pull_request-event, but this enables the choice for now. the intent is that one or the other should be used, not both. this is to prevent collisions between polling from the pull_request-event and the more intentional status-event processing. switching to the status-event eliminates polling, which allows acceptance to be triggered after what would have been beyond the polling timeout. hopefully this will also improve the behavior related to #77 because a successful status would need to be reported after the PR is opened. ideally this gives enough time for all checks to be registered for #21
- Loading branch information
Showing
7 changed files
with
61 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
import createActions from './github/actions'; | ||
|
||
export default function (request, {github, squash, deleteBranches = false, pollWhenPending}) { | ||
const {pull_request, number} = request.payload; | ||
export default function ( | ||
request, | ||
{head, url, number, comments_url}, | ||
{github, squash, deleteBranches = false, pollWhenPending} | ||
) { | ||
const {ensureAcceptability, acceptPR, deleteBranch, postErrorComment} = createActions(github); | ||
|
||
return ensureAcceptability({ | ||
repo: pull_request.head.repo, | ||
ref: pull_request.head.ref, | ||
url: pull_request.url, | ||
repo: head.repo, | ||
ref: head.ref, | ||
url, | ||
pollWhenPending | ||
}, message => request.log(message)) | ||
.then(() => acceptPR(pull_request.url, pull_request.head.sha, number, squash, message => request.log(message))) | ||
.then(() => deleteBranch(pull_request.head, deleteBranches)) | ||
.then(() => acceptPR(url, head.sha, number, squash, message => request.log(message))) | ||
.then(() => deleteBranch(head, deleteBranches)) | ||
.catch(err => { | ||
request.log(['error', 'PR'], err); | ||
|
||
return postErrorComment(pull_request.comments_url, err) | ||
return postErrorComment(comments_url, err) | ||
.catch(e => request.log(`failed to log comment against the PR: ${e}`)); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters