Skip to content
This repository was archived by the owner on Feb 11, 2022. It is now read-only.

Commit f72374c

Browse files
committed
fix(check-runs): allowed neutral conclusions to be processed
in addition to successful conclusions
1 parent f15b77b commit f72374c

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/handler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function checkRunEventIsSuccessfulAndCouldBeForGreenkeeperPR(checkRun, log) {
4646
return false;
4747
}
4848

49-
if ('success' !== conclusion) {
49+
if ('success' !== conclusion && 'neutral' !== conclusion) {
5050
log(['PR'], `check_run conclusion was \`${conclusion}\` instead of \`success\``);
5151
return false;
5252
}

test/unit/handler-test.js

+33
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,39 @@ suite('handler', () => {
215215
});
216216
});
217217

218+
test('that the webhook is accepted and processed for a neutral check_run and a matching greenkeeper PR', () => {
219+
const repository = any.simpleObject();
220+
const branch = any.string();
221+
const prNumber = any.integer();
222+
const sha = any.string();
223+
const partialPullRequest = {user: {html_url: greenkeeperSender}, number: prNumber};
224+
const fullPullRequest = {...any.simpleObject(), user: {html_url: greenkeeperSender}};
225+
const request = {
226+
payload: {
227+
action: 'completed',
228+
check_run: {
229+
status: 'completed',
230+
conclusion: 'neutral',
231+
head_sha: sha,
232+
check_suite: {
233+
head_branch: branch,
234+
pull_requests: [partialPullRequest]
235+
}
236+
},
237+
repository
238+
},
239+
headers: {'x-github-event': 'check_run'},
240+
log: () => undefined
241+
};
242+
response.withArgs('check_run event will be processed').returns({code});
243+
getPullRequest.withArgs(repository, prNumber).resolves(fullPullRequest);
244+
245+
return handler(request, {response}, settings).then(() => {
246+
assert.calledWith(code, ACCEPTED);
247+
assert.calledWith(process.default, fullPullRequest, settings);
248+
});
249+
});
250+
218251
test('that the response is bad-request when the status is not `completed`', () => {
219252
const status = any.string();
220253
const request = {

0 commit comments

Comments
 (0)