Skip to content

Commit

Permalink
fix(gitlab): Revert "feat(gitlab): try merging PR on creation (#3308)"
Browse files Browse the repository at this point in the history
This reverts commit 8bd7592.

Reverting until https://gitlab.com/gitlab-org/gitlab-ce/issues/56698 is fixed by GitLab
  • Loading branch information
rarkins committed Apr 25, 2019
1 parent 924a43d commit 788215a
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 59 deletions.
19 changes: 1 addition & 18 deletions lib/platform/gitlab/index.js
Expand Up @@ -639,9 +639,7 @@ async function createPr(
title,
description,
labels,
useDefaultBranch,
_,
automerge
useDefaultBranch
) {
const targetBranch = useDefaultBranch
? config.defaultBranch
Expand All @@ -665,21 +663,6 @@ async function createPr(
if (config.prList) {
config.prList.push(pr);
}
if (automerge === true) {
try {
await get.put(
`projects/${config.repository}/merge_requests/${pr.iid}/merge`,
{
body: {
should_remove_source_branch: true,
merge_when_pipeline_succeeds: true,
},
}
);
} catch (err) /* istanbul ignore next */ {
logger.debug({ err }, 'Automerge on PR creation failed');
}
}
return pr;
}

Expand Down
4 changes: 1 addition & 3 deletions lib/workers/pr/index.js
Expand Up @@ -247,15 +247,13 @@ async function ensurePr(prConfig) {
logger.info('DRY-RUN: Would create PR: ' + prTitle);
pr = { number: 0, displayNumber: 'Dry run PR' };
} else {
const automergePr = config.automerge && config.automergeType === 'pr';
pr = await platform.createPr(
branchName,
prTitle,
prBody,
config.labels,
false,
config.statusCheckVerify,
automergePr
config.statusCheckVerify
);
logger.info({ branch: branchName, pr: pr.number }, 'PR created');
}
Expand Down
14 changes: 0 additions & 14 deletions test/platform/gitlab/__snapshots__/index.spec.js.snap
Expand Up @@ -68,20 +68,6 @@ Array [
]
`;

exports[`platform/gitlab createPr(branchName, title, body) auto-accepts the MR when requested 1`] = `
Array [
Array [
"projects/undefined/merge_requests/12345/merge",
Object {
"body": Object {
"merge_when_pipeline_succeeds": true,
"should_remove_source_branch": true,
},
},
],
]
`;

exports[`platform/gitlab createPr(branchName, title, body) returns the PR 1`] = `
Object {
"branchName": "some-branch",
Expand Down
20 changes: 0 additions & 20 deletions test/platform/gitlab/index.spec.js
Expand Up @@ -806,26 +806,6 @@ describe('platform/gitlab', () => {
expect(pr).toMatchSnapshot();
expect(get.post.mock.calls).toMatchSnapshot();
});
it('auto-accepts the MR when requested', async () => {
get.post.mockReturnValueOnce({
body: {
id: 1,
iid: 12345,
},
});
const _ = 42;
const automerge = true;
await gitlab.createPr(
'some-branch',
'some-title',
'the-body',
[],
true,
_,
automerge
);
expect(get.put.mock.calls).toMatchSnapshot();
});
});
describe('getPr(prNo)', () => {
it('returns the PR', async () => {
Expand Down
4 changes: 0 additions & 4 deletions test/workers/pr/__snapshots__/index.spec.js.snap
Expand Up @@ -67,7 +67,6 @@ Array [
Array [],
false,
false,
false,
]
`;

Expand Down Expand Up @@ -112,7 +111,6 @@ Array [
Array [],
false,
false,
true,
]
`;

Expand Down Expand Up @@ -174,7 +172,6 @@ note 2
Array [],
false,
false,
false,
]
`;

Expand Down Expand Up @@ -219,7 +216,6 @@ Array [
Array [],
false,
false,
false,
]
`;

Expand Down

0 comments on commit 788215a

Please sign in to comment.