From 3120615c82eb86b85990f5304ed4c178212d10dc Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Fri, 21 Sep 2018 22:13:14 -0500 Subject: [PATCH] fix(greenkeeper-url): updated to match the new expected url --- src/greenkeeper.js | 2 +- src/handler.js | 5 +++-- test/unit/greenkeeper-test.js | 2 +- test/unit/handler-test.js | 5 +++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/greenkeeper.js b/src/greenkeeper.js index edd661d..8b1a03a 100644 --- a/src/greenkeeper.js +++ b/src/greenkeeper.js @@ -1,4 +1,4 @@ -export const GREENKEEPER_BOT_GITHUB_URL = 'https://github.com/greenkeeperio-bot'; +export const GREENKEEPER_BOT_GITHUB_URL = 'https://github.com/marketplace/greenkeeper'; export const GREENKEEPER_INTEGRATION_GITHUB_URL = 'https://github.com/apps/greenkeeper'; export default function (sender) { diff --git a/src/handler.js b/src/handler.js index ac209d5..17e1607 100644 --- a/src/handler.js +++ b/src/handler.js @@ -54,12 +54,13 @@ export default async function (request, responseToolkit, settings) { return responseToolkit.response(boom.internal('too many PRs exist for this commit')); } - if (openedByGreenkeeperBot(pullRequests[0].user.html_url)) { + const senderUrl = pullRequests[0].user.html_url; + if (openedByGreenkeeperBot(senderUrl)) { process(request, await getPullRequest(repository, pullRequests[0].number), settings); return responseToolkit.response('ok').code(ACCEPTED); } - return responseToolkit.response('PR is not from greenkeeper').code(BAD_REQUEST); + return responseToolkit.response(`PR is not from greenkeeper, but from ${senderUrl}`).code(BAD_REQUEST); }) .catch(e => boom.internal('failed to fetch PRs', e)); } diff --git a/test/unit/greenkeeper-test.js b/test/unit/greenkeeper-test.js index dd02e91..8440122 100644 --- a/test/unit/greenkeeper-test.js +++ b/test/unit/greenkeeper-test.js @@ -6,7 +6,7 @@ import openedByGreenkeeperBot, { suite('greenkeeper', () => { test('that the users are defined to match the greenkeeper bots', () => { - assert.equal(GREENKEEPER_BOT_GITHUB_URL, 'https://github.com/greenkeeperio-bot'); + assert.equal(GREENKEEPER_BOT_GITHUB_URL, 'https://github.com/marketplace/greenkeeper'); assert.equal(GREENKEEPER_INTEGRATION_GITHUB_URL, 'https://github.com/apps/greenkeeper'); }); diff --git a/test/unit/handler-test.js b/test/unit/handler-test.js index 5c2b38a..c06dbbf 100644 --- a/test/unit/handler-test.js +++ b/test/unit/handler-test.js @@ -178,13 +178,14 @@ suite('handler', () => { }); test('that the response is bad-request if the PR is not from greenkeeper', () => { + const senderUrl = any.url(); const request = { payload: {state: 'success', branches: [{name: any.string()}]}, headers: {'x-github-event': 'status'}, log: () => undefined }; - getPullRequestsForCommit.resolves([{user: {html_url: any.url()}}]); - response.withArgs('PR is not from greenkeeper').returns({code}); + getPullRequestsForCommit.resolves([{user: {html_url: senderUrl}}]); + response.withArgs(`PR is not from greenkeeper, but from ${senderUrl}`).returns({code}); return handler(request, {response}, settings).then(() => assert.calledWith(code, BAD_REQUEST)); });