diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index 11d036d6fe..e90c2ccc6c 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -382,9 +382,9 @@ function addReviewers(iid, reviewers) { } async function getComments(issueNo) { - // GET https://gitlab.com/api/v4/projects/:owner/:repo/merge_requests/:number/notes + // GET /api/v4/projects/:owner/:repo/merge_requests/:number/notes logger.debug(`Getting comments for #${issueNo}`); - const url = `https://gitlab.com/api/v4/projects/${ + const url = `/api/v4/projects/${ config.repository }/merge_requests/${issueNo}/notes`; const comments = (await get(url, { paginate: true })).body; @@ -393,11 +393,9 @@ async function getComments(issueNo) { } async function addComment(issueNo, body) { - // POST https://gitlab.com/api/v4/projects/:owner/:repo/merge_requests/:number/notes + // POST /api/v4/projects/:owner/:repo/merge_requests/:number/notes await get.post( - `https://gitlab.com/api/v4/projects/${ - config.repository - }/merge_requests/${issueNo}/notes`, + `/api/v4/projects/${config.repository}/merge_requests/${issueNo}/notes`, { body: { body }, } @@ -405,9 +403,9 @@ async function addComment(issueNo, body) { } async function editComment(issueNo, commentId, body) { - // PATCH https://gitlab.com/api/v4/projects/:owner/:repo/merge_requests/:number/notes/:id + // PATCH /api/v4/projects/:owner/:repo/merge_requests/:number/notes/:id await get.patch( - `https://gitlab.com/api/v4/projects/${ + `/api/v4/projects/${ config.repository }/merge_requests/${issueNo}/notes/${commentId}`, { @@ -417,9 +415,9 @@ async function editComment(issueNo, commentId, body) { } async function deleteComment(issueNo, commentId) { - // DELETE https://gitlab.com/api/v4/projects/:owner/:repo/merge_requests/:number/notes/:id + // DELETE /api/v4/projects/:owner/:repo/merge_requests/:number/notes/:id await get.delete( - `https://gitlab.com/api/v4/projects/${ + `/api/v4/projects/${ config.repository }/merge_requests/${issueNo}/notes/${commentId}` ); diff --git a/test/platform/gitlab/__snapshots__/index.spec.js.snap b/test/platform/gitlab/__snapshots__/index.spec.js.snap index 231763b493..26034a9fcd 100644 --- a/test/platform/gitlab/__snapshots__/index.spec.js.snap +++ b/test/platform/gitlab/__snapshots__/index.spec.js.snap @@ -127,7 +127,7 @@ Array [ exports[`platform/gitlab ensureComment add comment if not found 1`] = ` Array [ Array [ - "https://gitlab.com/api/v4/projects/some%2Frepo/merge_requests/42/notes", + "/api/v4/projects/some%2Frepo/merge_requests/42/notes", Object { "body": Object { "body": "### some-subject @@ -143,7 +143,7 @@ content", exports[`platform/gitlab ensureComment add updates comment if necessary 1`] = ` Array [ Array [ - "https://gitlab.com/api/v4/projects/some%2Frepo/merge_requests/42/notes/1234", + "/api/v4/projects/some%2Frepo/merge_requests/42/notes/1234", Object { "body": Object { "body": "### some-subject