From 3a34d11e147e642843e184a4e287c25dfbcca743 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Mon, 31 Jan 2022 15:35:40 +0100 Subject: [PATCH] refactor(platform): remove unnecessary pr.canMerge cases (#13914) --- .../__snapshots__/index.spec.ts.snap | 610 ------------------ lib/platform/bitbucket-server/index.spec.ts | 101 +-- lib/platform/bitbucket-server/index.ts | 11 - .../gitea/__snapshots__/index.spec.ts.snap | 16 +- lib/platform/gitea/index.spec.ts | 2 +- lib/platform/gitea/index.ts | 4 +- .../__fixtures__/graphql/pullrequest-1.json | 6 +- .../github/__snapshots__/index.spec.ts.snap | 41 +- lib/platform/github/graphql.ts | 1 - lib/platform/github/index.spec.ts | 2 - lib/platform/github/index.ts | 21 +- lib/platform/github/types.ts | 1 - .../gitlab/__snapshots__/index.spec.ts.snap | 49 -- lib/platform/gitlab/index.spec.ts | 28 +- lib/platform/gitlab/index.ts | 9 - lib/platform/types.ts | 3 +- lib/workers/pr/automerge.spec.ts | 6 +- lib/workers/pr/automerge.ts | 5 +- lib/workers/pr/index.spec.ts | 6 +- 19 files changed, 44 insertions(+), 878 deletions(-) diff --git a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap index 9c9c81793..cecdbcfcc 100644 --- a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap +++ b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap @@ -42,18 +42,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -96,18 +84,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -149,18 +125,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -203,18 +167,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -258,18 +210,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -411,18 +351,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -496,18 +424,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -579,18 +495,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -1593,7 +1497,6 @@ exports[`platform/bitbucket-server/index endpoint with no path getBranchPr() has Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -1659,18 +1562,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -2317,7 +2208,6 @@ exports[`platform/bitbucket-server/index endpoint with no path getPr() canRebase Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -2337,7 +2227,6 @@ exports[`platform/bitbucket-server/index endpoint with no path getPr() canRebase Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -2357,7 +2246,6 @@ exports[`platform/bitbucket-server/index endpoint with no path getPr() canRebase Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -2411,18 +2299,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -2435,18 +2311,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -2459,18 +2323,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -2478,7 +2330,6 @@ exports[`platform/bitbucket-server/index endpoint with no path getPr() gets a PR Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -2532,18 +2383,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -2913,18 +2752,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -2978,18 +2805,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -3113,18 +2928,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -3178,18 +2981,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -3838,18 +3629,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -3929,18 +3708,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -3979,18 +3746,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -4052,18 +3807,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -4131,18 +3874,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -4224,18 +3955,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -4373,18 +4092,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -4452,18 +4159,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -4535,18 +4230,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -4589,18 +4272,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -4642,18 +4313,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -4696,18 +4355,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -4751,18 +4398,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -4904,18 +4539,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -4989,18 +4612,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -5072,18 +4683,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "reviewers": Array [ @@ -6086,7 +5685,6 @@ exports[`platform/bitbucket-server/index endpoint with path getBranchPr() has pr Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -6152,18 +5750,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -6810,7 +6396,6 @@ exports[`platform/bitbucket-server/index endpoint with path getPr() canRebase 1` Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -6830,7 +6415,6 @@ exports[`platform/bitbucket-server/index endpoint with path getPr() canRebase 2` Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -6850,7 +6434,6 @@ exports[`platform/bitbucket-server/index endpoint with path getPr() canRebase 3` Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -6904,18 +6487,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -6928,18 +6499,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -6952,18 +6511,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -6971,7 +6518,6 @@ exports[`platform/bitbucket-server/index endpoint with path getPr() gets a PR 1` Object { "body": "* Line 1 * Line 2", - "canMerge": false, "createdAt": 1547853840016, "displayNumber": "Pull Request #5", "hasReviewers": true, @@ -7025,18 +6571,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, ] `; @@ -7406,18 +6940,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -7471,18 +6993,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -7606,18 +7116,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -7671,18 +7169,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "headers": Object { "accept": "application/json", @@ -8331,18 +7817,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -8422,18 +7896,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -8472,18 +7934,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -8545,18 +7995,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -8624,18 +8062,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -8717,18 +8143,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -8866,18 +8280,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", @@ -8945,18 +8347,6 @@ Array [ "method": "GET", "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Basic YWJjOjEyMw==", - "host": "stash.renovatebot.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - "x-atlassian-token": "no-check", - }, - "method": "GET", - "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - }, Object { "body": Object { "description": "body", diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts index c031b8652..5e7396a1a 100644 --- a/lib/platform/bitbucket-server/index.spec.ts +++ b/lib/platform/bitbucket-server/index.spec.ts @@ -486,11 +486,6 @@ describe('platform/bitbucket-server/index', () => { it('does not throw', async () => { const scope = await initRepo(); scope - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .twice() - .reply(200, { conflicted: false }) .get( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -509,11 +504,6 @@ describe('platform/bitbucket-server/index', () => { expect.assertions(1); const scope = await initRepo(); scope - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .twice() - .reply(200, { conflicted: false }) .get( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -559,10 +549,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -582,10 +568,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -603,10 +585,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -643,10 +621,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -1136,11 +1110,7 @@ describe('platform/bitbucket-server/index', () => { .get( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) - .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }); + .reply(200, prMock(url, 'SOME', 'repo')); expect( await bitbucket.getBranchPr('userName1/pullRequest5') @@ -1279,11 +1249,7 @@ describe('platform/bitbucket-server/index', () => { .get( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) - .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }); + .reply(200, prMock(url, 'SOME', 'repo')); expect(await bitbucket.getPr(5)).toMatchSnapshot(); expect(httpMock.getTrace()).toMatchSnapshot(); @@ -1296,20 +1262,11 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/merge` - ) - .reply(200, { conflicted: false }) .get( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .twice() - .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .twice() - .reply(200, { conflicted: false }); + .reply(200, prMock(url, 'SOME', 'repo')); expect(await bitbucket.getPr(3)).toMatchSnapshot(); @@ -1348,10 +1305,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -1372,10 +1325,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -1401,10 +1350,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -1457,10 +1402,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -1480,10 +1421,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -1510,10 +1447,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5`, (body) => body.reviewers.length === 0 @@ -1537,10 +1470,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -1559,10 +1488,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .put( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) @@ -1583,10 +1508,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .post( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1` ) @@ -1635,10 +1556,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .post( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1` ) @@ -1660,10 +1577,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .post( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1` ) @@ -1685,10 +1598,6 @@ describe('platform/bitbucket-server/index', () => { `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` ) .reply(200, prMock(url, 'SOME', 'repo')) - .get( - `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` - ) - .reply(200, { conflicted: false }) .post( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1` ) @@ -2112,9 +2021,9 @@ Followed by some information. it('returns file content in json5 format', async () => { const json5Data = ` - { + { // json5 comment - foo: 'bar' + foo: 'bar' } `; const scope = await initRepo(); diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts index 087b0413c..50755715a 100644 --- a/lib/platform/bitbucket-server/index.ts +++ b/lib/platform/bitbucket-server/index.ts @@ -289,17 +289,6 @@ export async function getPr( pr.hasReviewers = is.nonEmptyArray(pr.reviewers); pr.version = updatePrVersion(pr.number, pr.version); - if (pr.state === PrState.Open) { - const mergeRes = await bitbucketServerHttp.getJson<{ - conflicted: string; - canMerge: string; - }>( - `./rest/api/1.0/projects/${config.projectKey}/repos/${config.repositorySlug}/pull-requests/${prNo}/merge`, - { useCache: !refreshCache } - ); - pr.canMerge = !!mergeRes.body.canMerge; - } - return pr; } diff --git a/lib/platform/gitea/__snapshots__/index.spec.ts.snap b/lib/platform/gitea/__snapshots__/index.spec.ts.snap index f24e5756a..5ca5cfa78 100644 --- a/lib/platform/gitea/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitea/__snapshots__/index.spec.ts.snap @@ -3,7 +3,7 @@ exports[`platform/gitea/index createPr should use base branch by default 1`] = ` Object { "body": "pr-body", - "canMerge": true, + "cannotMergeReason": undefined, "createdAt": "2014-04-01T05:14:20Z", "displayNumber": "Pull Request #42", "hasAssignees": false, @@ -20,7 +20,7 @@ Object { exports[`platform/gitea/index createPr should use default branch if requested 1`] = ` Object { "body": "pr-body", - "canMerge": true, + "cannotMergeReason": undefined, "createdAt": "2014-04-01T05:14:20Z", "displayNumber": "Pull Request #42", "hasAssignees": false, @@ -37,7 +37,7 @@ Object { exports[`platform/gitea/index getPr should fallback to direct fetching if cache fails 1`] = ` Object { "body": "some random pull request", - "canMerge": true, + "cannotMergeReason": "pr.mergeable=\\"false\\"", "createdAt": "2015-03-22T20:36:16Z", "displayNumber": "Pull Request #1", "hasAssignees": false, @@ -54,7 +54,7 @@ Object { exports[`platform/gitea/index getPr should return enriched pull request which exists if open 1`] = ` Object { "body": "some random pull request", - "canMerge": true, + "cannotMergeReason": undefined, "createdAt": "2015-03-22T20:36:16Z", "displayNumber": "Pull Request #1", "hasAssignees": false, @@ -79,7 +79,7 @@ exports[`platform/gitea/index getPrList should filter list by creator 2`] = ` Array [ Object { "body": "some random pull request", - "canMerge": true, + "cannotMergeReason": undefined, "createdAt": "2015-03-22T20:36:16Z", "displayNumber": "Pull Request #1", "hasAssignees": false, @@ -93,7 +93,7 @@ Array [ }, Object { "body": "other random pull request", - "canMerge": true, + "cannotMergeReason": undefined, "createdAt": "2011-08-18T22:30:38Z", "displayNumber": "Pull Request #2", "hasAssignees": false, @@ -112,7 +112,7 @@ exports[`platform/gitea/index getPrList should return list of pull requests 1`] Array [ Object { "body": "some random pull request", - "canMerge": true, + "cannotMergeReason": undefined, "createdAt": "2015-03-22T20:36:16Z", "displayNumber": "Pull Request #1", "hasAssignees": false, @@ -126,7 +126,7 @@ Array [ }, Object { "body": "other random pull request", - "canMerge": true, + "cannotMergeReason": undefined, "createdAt": "2011-08-18T22:30:38Z", "displayNumber": "Pull Request #2", "hasAssignees": false, diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts index ec60644da..922ec06b0 100644 --- a/lib/platform/gitea/index.spec.ts +++ b/lib/platform/gitea/index.spec.ts @@ -576,7 +576,7 @@ describe('platform/gitea/index', () => { it('should fallback to direct fetching if cache fails', async () => { const mockPR = mockPRs[0]; helper.searchPRs.mockResolvedValueOnce([]); - helper.getPR.mockResolvedValueOnce(mockPR); + helper.getPR.mockResolvedValueOnce({ ...mockPR, mergeable: false }); await initFakeRepo(); const res = await gitea.getPr(mockPR.number); diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index e55150cff..b971c039e 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -102,7 +102,9 @@ function toRenovatePR(data: helper.PR): Pr | null { targetBranch: data.base.ref, sourceRepo: data.head.repo.full_name, createdAt: data.created_at, - canMerge: data.mergeable, + cannotMergeReason: data.mergeable + ? undefined + : `pr.mergeable="${data.mergeable}"`, hasAssignees: !!(data.assignee?.login || is.nonEmptyArray(data.assignees)), }; } diff --git a/lib/platform/github/__fixtures__/graphql/pullrequest-1.json b/lib/platform/github/__fixtures__/graphql/pullrequest-1.json index 21ffb13b7..b55fe53f2 100644 --- a/lib/platform/github/__fixtures__/graphql/pullrequest-1.json +++ b/lib/platform/github/__fixtures__/graphql/pullrequest-1.json @@ -9,7 +9,6 @@ "baseRefName": "master", "headRefName": "renovate/major-got-packages", "title": "build(deps): update got packages (major)", - "mergeable": "MERGEABLE", "mergeStateStatus": "CLEAN", "labels": { "nodes": [ @@ -24,20 +23,17 @@ "baseRefName": "master", "headRefName": "renovate/jest-monorepo", "title": "chore(deps): update dependency jest to v23.6.0", - "mergeable": "UNKNOWN", "mergeStateStatus": "DIRTY" }, { "number": 2079, "headRefName": "feat/nodever", - "title": "feat: node versioning (WIP)", - "mergeable": "MERGEABLE" + "title": "feat: node versioning (WIP)" }, { "number": 2086, "headRefName": "fix/deletePRafterDeleteBranch", "title": "feat(azure): abandon pr after delete branch", - "mergeable": "MERGEABLE", "mergeStateStatus": "BEHIND", "reviews": { "nodes": [ ] } } diff --git a/lib/platform/github/__snapshots__/index.spec.ts.snap b/lib/platform/github/__snapshots__/index.spec.ts.snap index 1016366a0..bf9142344 100644 --- a/lib/platform/github/__snapshots__/index.spec.ts.snap +++ b/lib/platform/github/__snapshots__/index.spec.ts.snap @@ -3386,8 +3386,6 @@ Object { "base": Object { "sha": "1234", }, - "canMerge": false, - "canMergeReason": "mergeable = undefined", "commits": 1, "deletions": 1, "displayNumber": "Pull Request #91", @@ -3537,7 +3535,6 @@ Array [ }, }, "mergeStateStatus": null, - "mergeable": null, "number": null, "reviewRequests": Object { "totalCount": null, @@ -3573,7 +3570,7 @@ Array [ "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "934", + "content-length": "915", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -3730,8 +3727,6 @@ Object { "base": Object { "sha": "1234", }, - "canMerge": false, - "canMergeReason": "mergeable = undefined", "commits": 1, "deletions": 1, "displayNumber": "Pull Request #91", @@ -3848,7 +3843,6 @@ Array [ }, }, "mergeStateStatus": null, - "mergeable": null, "number": null, "reviewRequests": Object { "totalCount": null, @@ -3884,7 +3878,7 @@ Array [ "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "934", + "content-length": "915", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -3980,8 +3974,6 @@ Object { "base": Object { "sha": "1234", }, - "canMerge": false, - "canMergeReason": "mergeable = undefined", "commits": 1, "deletions": 1, "displayNumber": "Pull Request #90", @@ -4137,7 +4129,6 @@ Array [ }, }, "mergeStateStatus": null, - "mergeable": null, "number": null, "reviewRequests": Object { "totalCount": null, @@ -4173,7 +4164,7 @@ Array [ "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "934", + "content-length": "915", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -5345,7 +5336,6 @@ Array [ }, }, "mergeStateStatus": null, - "mergeable": null, "number": null, "reviewRequests": Object { "totalCount": null, @@ -5381,7 +5371,7 @@ Array [ "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "934", + "content-length": "915", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -5462,8 +5452,7 @@ Array [ exports[`platform/github/index getPr(prNo) should return PR from graphql result 1`] = ` Object { - "canMerge": false, - "canMergeReason": "mergeStateStatus = DIRTY", + "cannotMergeReason": "pr.mergeStateStatus = DIRTY", "displayNumber": "Pull Request #2500", "hasAssignees": false, "hasReviewers": false, @@ -5564,7 +5553,6 @@ Array [ }, }, "mergeStateStatus": null, - "mergeable": null, "number": null, "reviewRequests": Object { "totalCount": null, @@ -5600,7 +5588,7 @@ Array [ "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "934", + "content-length": "915", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -5617,7 +5605,6 @@ Object { "sha": "1234", }, "displayNumber": "Pull Request #1", - "mergeable": true, "merged_at": "sometime", "number": 1, "state": "closed", @@ -5713,7 +5700,6 @@ Array [ }, }, "mergeStateStatus": null, - "mergeable": null, "number": null, "reviewRequests": Object { "totalCount": null, @@ -5749,7 +5735,7 @@ Array [ "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "934", + "content-length": "915", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -5844,8 +5830,6 @@ Object { "base": Object { "sha": "1234", }, - "canMerge": false, - "canMergeReason": "mergeable = undefined", "commits": 1, "displayNumber": "Pull Request #1", "mergeable_state": "dirty", @@ -5945,7 +5929,6 @@ Array [ }, }, "mergeStateStatus": null, - "mergeable": null, "number": null, "reviewRequests": Object { "totalCount": null, @@ -5981,7 +5964,7 @@ Array [ "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "934", + "content-length": "915", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -6076,10 +6059,8 @@ Object { "base": Object { "sha": "5678", }, - "canMerge": true, "commits": 1, "displayNumber": "Pull Request #1", - "mergeable": true, "number": 1, "sha": undefined, "sourceBranch": undefined, @@ -6176,7 +6157,6 @@ Array [ }, }, "mergeStateStatus": null, - "mergeable": null, "number": null, "reviewRequests": Object { "totalCount": null, @@ -6212,7 +6192,7 @@ Array [ "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "934", + "content-length": "915", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -6391,7 +6371,6 @@ Array [ }, }, "mergeStateStatus": null, - "mergeable": null, "number": null, "reviewRequests": Object { "totalCount": null, @@ -6427,7 +6406,7 @@ Array [ "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "934", + "content-length": "915", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", diff --git a/lib/platform/github/graphql.ts b/lib/platform/github/graphql.ts index 184c8c711..f9e4adfc3 100644 --- a/lib/platform/github/graphql.ts +++ b/lib/platform/github/graphql.ts @@ -73,7 +73,6 @@ query($owner: String!, $name: String!, $count: Int, $cursor: String) { headRefName baseRefName title - mergeable mergeStateStatus labels(last: 100) { nodes { diff --git a/lib/platform/github/index.spec.ts b/lib/platform/github/index.spec.ts index 7e5f0b3b1..768693282 100644 --- a/lib/platform/github/index.spec.ts +++ b/lib/platform/github/index.spec.ts @@ -2136,7 +2136,6 @@ describe('platform/github/index', () => { number: 1, state: PrState.Closed, base: { sha: '1234' }, - mergeable: true, merged_at: 'sometime', }) .post('/graphql') @@ -2183,7 +2182,6 @@ describe('platform/github/index', () => { state: PrState.Open, base: { sha: '5678' }, commits: 1, - mergeable: true, }) .post('/graphql') .twice() diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 0c0f4c438..c90c1bc52 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -612,17 +612,9 @@ async function getOpenPrs(): Promise { const hasNegativeReview = pr.reviews?.nodes?.length > 0; // istanbul ignore if if (hasNegativeReview) { - pr.canMerge = false; - pr.canMergeReason = `hasNegativeReview`; - } else if (canMergeStates.includes(pr.mergeStateStatus)) { - pr.canMerge = true; - } else if (config.forkToken && pr.mergeStateStatus === 'BLOCKED') { - // The main token can't merge but maybe the forking token can - // istanbul ignore next - pr.canMerge = true; - } else { - pr.canMerge = false; - pr.canMergeReason = `mergeStateStatus = ${pr.mergeStateStatus}`; + pr.cannotMergeReason = `PR has a negative review`; + } else if (!canMergeStates.includes(pr.mergeStateStatus)) { + pr.cannotMergeReason = `pr.mergeStateStatus = ${pr.mergeStateStatus}`; } if (pr.labels) { pr.labels = pr.labels.nodes.map((label) => label.name); @@ -631,7 +623,6 @@ async function getOpenPrs(): Promise { delete pr.assignees; pr.hasReviewers = !!(pr.reviewRequests?.totalCount > 0); delete pr.reviewRequests; - delete pr.mergeable; delete pr.mergeStateStatus; config.openPrList[pr.number] = pr; prNumbers.push(pr.number); @@ -679,12 +670,6 @@ export async function getPr(prNo: number): Promise { if (pr.state === PrState.Open) { pr.sourceBranch = pr.head ? pr.head.ref : undefined; pr.sha = pr.head ? pr.head.sha : undefined; - if (pr.mergeable === true) { - pr.canMerge = true; - } else { - pr.canMerge = false; - pr.canMergeReason = `mergeable = ${pr.mergeable}`; - } } return pr; } diff --git a/lib/platform/github/types.ts b/lib/platform/github/types.ts index dfe99fc72..3414635c9 100644 --- a/lib/platform/github/types.ts +++ b/lib/platform/github/types.ts @@ -22,7 +22,6 @@ export interface Comment { export interface GhPr extends Pr { comments: Comment[]; - mergeable: boolean; } export interface GhRestPr extends GhPr { diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap index 4180bbfec..8b2dae9b1 100644 --- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap @@ -1786,17 +1786,6 @@ Array [ "method": "GET", "url": "https://gitlab.com/api/v4/projects/some%2Frepo/merge_requests/91?include_diverged_commits_count=1", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Bearer 123test", - "host": "gitlab.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - }, - "method": "GET", - "url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e/statuses", - }, ] `; @@ -1852,17 +1841,6 @@ Array [ "method": "GET", "url": "https://gitlab.com/api/v4/projects/some%2Frepo/merge_requests/91?include_diverged_commits_count=1", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Bearer 123test", - "host": "gitlab.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - }, - "method": "GET", - "url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e/statuses", - }, ] `; @@ -1918,17 +1896,6 @@ Array [ "method": "GET", "url": "https://gitlab.com/api/v4/projects/some%2Frepo/merge_requests/91?include_diverged_commits_count=1", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Bearer 123test", - "host": "gitlab.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - }, - "method": "GET", - "url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e/statuses", - }, ] `; @@ -2437,7 +2404,6 @@ Array [ exports[`platform/gitlab/index getPr(prNo) removes deprecated draft prefix from returned title 1`] = ` Object { "body": "a merge request", - "canMerge": false, "displayNumber": "Merge Request #12345", "hasAssignees": false, "hasReviewers": false, @@ -2471,7 +2437,6 @@ Array [ exports[`platform/gitlab/index getPr(prNo) removes draft prefix from returned title 1`] = ` Object { "body": "a merge request", - "canMerge": false, "displayNumber": "Merge Request #12345", "hasAssignees": false, "hasReviewers": false, @@ -2505,7 +2470,6 @@ Array [ exports[`platform/gitlab/index getPr(prNo) returns the PR 1`] = ` Object { "body": "a merge request", - "canMerge": false, "displayNumber": "Merge Request #12345", "hasAssignees": false, "hasReviewers": false, @@ -2538,7 +2502,6 @@ Array [ exports[`platform/gitlab/index getPr(prNo) returns the PR with nonexisting branch 1`] = ` Object { "body": "a merge request", - "canMerge": false, "displayNumber": "Merge Request #12345", "hasAssignees": true, "hasReviewers": false, @@ -2571,7 +2534,6 @@ Array [ exports[`platform/gitlab/index getPr(prNo) returns the mergeable PR 1`] = ` Object { "body": "a merge request", - "canMerge": true, "displayNumber": "Merge Request #12345", "hasAssignees": true, "hasReviewers": false, @@ -2609,17 +2571,6 @@ Array [ "method": "GET", "url": "https://gitlab.com/api/v4/projects/some%2Frepo/merge_requests/12345?include_diverged_commits_count=1", }, - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "authorization": "Bearer 123test", - "host": "gitlab.com", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - }, - "method": "GET", - "url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e/statuses", - }, ] `; diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts index e64f45b7d..0dd4c6401 100644 --- a/lib/platform/gitlab/index.spec.ts +++ b/lib/platform/gitlab/index.spec.ts @@ -439,11 +439,7 @@ describe('platform/gitlab/index', () => { base: { sha: '1234', }, - }) - .get( - '/api/v4/projects/some%2Frepo/repository/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e/statuses' - ) - .reply(200, []); + }); const pr = await gitlab.getBranchPr('some-branch'); expect(pr).toMatchSnapshot(); expect(httpMock.getTrace()).toMatchSnapshot(); @@ -478,11 +474,7 @@ describe('platform/gitlab/index', () => { base: { sha: '1234', }, - }) - .get( - '/api/v4/projects/some%2Frepo/repository/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e/statuses' - ) - .reply(200, []); + }); const pr = await gitlab.getBranchPr('some-branch'); expect(pr).toMatchSnapshot(); expect(httpMock.getTrace()).toMatchSnapshot(); @@ -517,11 +509,7 @@ describe('platform/gitlab/index', () => { base: { sha: '1234', }, - }) - .get( - '/api/v4/projects/some%2Frepo/repository/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e/statuses' - ) - .reply(200, []); + }); const pr = await gitlab.getBranchPr('some-branch'); expect(pr).toMatchSnapshot(); expect(httpMock.getTrace()).toMatchSnapshot(); @@ -1757,11 +1745,7 @@ describe('platform/gitlab/index', () => { assignee: { id: 1, }, - }) - .get( - '/api/v4/projects/some%2Frepo/repository/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e/statuses' - ) - .reply(200, [{ status: 'success' }]); + }); const pr = await gitlab.getPr(12345); expect(pr).toMatchSnapshot(); expect(pr.hasAssignees).toBeTrue(); @@ -1987,9 +1971,9 @@ These updates have all been created already. Click a checkbox below to force a r it('returns file content in json5 format', async () => { const json5Data = ` - { + { // json5 comment - foo: 'bar' + foo: 'bar' } `; const scope = await initRepo(); diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index 57ec3d30c..d6cc81bfb 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -611,15 +611,6 @@ export async function getPr(iid: number): Promise { sha: mr.sha, }; - if (mr.merge_status === 'cannot_be_merged') { - logger.debug('pr cannot be merged'); - pr.canMerge = false; - } else if (pr.state === PrState.Open) { - const branchStatus = await getBranchStatus(pr.sourceBranch); - if (branchStatus === BranchStatus.green) { - pr.canMerge = true; - } - } return massagePr(pr); } diff --git a/lib/platform/types.ts b/lib/platform/types.ts index 4c2be6278..6a65a04d8 100644 --- a/lib/platform/types.ts +++ b/lib/platform/types.ts @@ -49,8 +49,7 @@ export interface RepoParams { export interface Pr { body?: string; sourceBranch: string; - canMerge?: boolean; - canMergeReason?: string; + cannotMergeReason?: string; // for reflecting platform policies which may prevent merging createdAt?: string; closedAt?: string; displayNumber?: string; diff --git a/lib/workers/pr/automerge.spec.ts b/lib/workers/pr/automerge.spec.ts index d4ae442c2..036796fbb 100644 --- a/lib/workers/pr/automerge.spec.ts +++ b/lib/workers/pr/automerge.spec.ts @@ -17,9 +17,7 @@ describe('workers/pr/automerge', () => { config = partial({ ...defaultConfig, }); - pr = partial({ - canMerge: true, - }); + pr = partial({}); }); afterEach(() => { jest.clearAllMocks(); @@ -89,7 +87,7 @@ describe('workers/pr/automerge', () => { }); it('should not automerge if enabled and pr is mergeable but unstable', async () => { config.automerge = true; - pr.canMerge = undefined; + pr.cannotMergeReason = 'some reason'; const res = await prAutomerge.checkAutoMerge(pr, config); expect(res).toEqual({ automerged: false, diff --git a/lib/workers/pr/automerge.ts b/lib/workers/pr/automerge.ts index 87cb20921..ad9812b3f 100644 --- a/lib/workers/pr/automerge.ts +++ b/lib/workers/pr/automerge.ts @@ -50,10 +50,9 @@ export async function checkAutoMerge( prAutomergeBlockReason: PrAutomergeBlockReason.Conflicted, }; } - if (!ignoreTests && pr.canMerge !== true) { + if (!ignoreTests && pr.cannotMergeReason) { logger.debug( - { canMergeReason: pr.canMergeReason }, - 'PR is not ready for merge' + `Platform reported that PR is not ready for merge. Reason: [${pr.cannotMergeReason}]` ); return { automerged: false, diff --git a/lib/workers/pr/index.spec.ts b/lib/workers/pr/index.spec.ts index 27efa86b9..10ecda97d 100644 --- a/lib/workers/pr/index.spec.ts +++ b/lib/workers/pr/index.spec.ts @@ -102,9 +102,7 @@ describe('workers/pr/index', () => { config = partial({ ...getConfig(), }); - pr = partial({ - canMerge: true, - }); + pr = partial({}); }); afterEach(() => { jest.clearAllMocks(); @@ -154,7 +152,7 @@ describe('workers/pr/index', () => { }); it('should not automerge if enabled and pr is mergeable but unstable', async () => { config.automerge = true; - pr.canMerge = undefined; + pr.cannotMergeReason = 'some reason'; await prAutomerge.checkAutoMerge(pr, config); expect(platform.mergePr).toHaveBeenCalledTimes(0); });