Skip to content

Commit d74a787

Browse files
authored
fix(#151): fix gitlab post comments url (#152)
1 parent 3a9d367 commit d74a787

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎dist/cli/index.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,9 @@ class GitLabClient {
11511151
// example: <host>/api/v4/projects/<namespace>%2Fbackporting-example/merge_requests/1
11521152
async getPullRequest(namespace, repo, mrNumber, squash) {
11531153
const projectId = this.getProjectId(namespace, repo);
1154-
const { data } = await this.client.get(`/projects/${projectId}/merge_requests/${mrNumber}`);
1154+
const url = `/projects/${projectId}/merge_requests/${mrNumber}`;
1155+
this.logger.debug(`Fetching pull request ${url}`);
1156+
const { data } = await this.client.get(`${url}`);
11551157
if (squash === undefined) {
11561158
squash = (0, git_util_1.inferSquash)(data.state === "opened", data.squash_commit_sha);
11571159
}
@@ -1241,7 +1243,7 @@ class GitLabClient {
12411243
try {
12421244
const { namespace, project, id } = this.extractMergeRequestData(mrUrl);
12431245
const projectId = this.getProjectId(namespace, project);
1244-
const { data } = await this.client.post(`/projects/${projectId}/issues/${id}/notes`, {
1246+
const { data } = await this.client.post(`/projects/${projectId}/merge_requests/${id}/notes`, {
12451247
body: comment,
12461248
});
12471249
if (!data) {

‎dist/gha/index.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,9 @@ class GitLabClient {
11161116
// example: <host>/api/v4/projects/<namespace>%2Fbackporting-example/merge_requests/1
11171117
async getPullRequest(namespace, repo, mrNumber, squash) {
11181118
const projectId = this.getProjectId(namespace, repo);
1119-
const { data } = await this.client.get(`/projects/${projectId}/merge_requests/${mrNumber}`);
1119+
const url = `/projects/${projectId}/merge_requests/${mrNumber}`;
1120+
this.logger.debug(`Fetching pull request ${url}`);
1121+
const { data } = await this.client.get(`${url}`);
11201122
if (squash === undefined) {
11211123
squash = (0, git_util_1.inferSquash)(data.state === "opened", data.squash_commit_sha);
11221124
}
@@ -1206,7 +1208,7 @@ class GitLabClient {
12061208
try {
12071209
const { namespace, project, id } = this.extractMergeRequestData(mrUrl);
12081210
const projectId = this.getProjectId(namespace, project);
1209-
const { data } = await this.client.post(`/projects/${projectId}/issues/${id}/notes`, {
1211+
const { data } = await this.client.post(`/projects/${projectId}/merge_requests/${id}/notes`, {
12101212
body: comment,
12111213
});
12121214
if (!data) {

‎mise.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tools]
2+
node = "20"

‎src/service/git/gitlab/gitlab-client.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export default class GitLabClient implements GitClient {
4848
// example: <host>/api/v4/projects/<namespace>%2Fbackporting-example/merge_requests/1
4949
async getPullRequest(namespace: string, repo: string, mrNumber: number, squash: boolean | undefined): Promise<GitPullRequest> {
5050
const projectId = this.getProjectId(namespace, repo);
51-
const { data } = await this.client.get(`/projects/${projectId}/merge_requests/${mrNumber}`);
51+
const url = `/projects/${projectId}/merge_requests/${mrNumber}`;
52+
this.logger.debug(`Fetching pull request ${url}`);
53+
const { data } = await this.client.get(`${url}`);
5254

5355
if (squash === undefined) {
5456
squash = inferSquash(data.state === "opened", data.squash_commit_sha);
@@ -169,7 +171,7 @@ export default class GitLabClient implements GitClient {
169171
const { namespace, project, id } = this.extractMergeRequestData(mrUrl);
170172
const projectId = this.getProjectId(namespace, project);
171173

172-
const { data } = await this.client.post(`/projects/${projectId}/issues/${id}/notes`, {
174+
const { data } = await this.client.post(`/projects/${projectId}/merge_requests/${id}/notes`, {
173175
body: comment,
174176
});
175177

0 commit comments

Comments
 (0)