mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-04-25 04:42:13 +00:00
fix(#151): fix gitlab post comments url
This commit is contained in:
parent
3a9d367b48
commit
69b693bed0
4 changed files with 14 additions and 6 deletions
6
dist/cli/index.js
vendored
6
dist/cli/index.js
vendored
|
@ -1151,7 +1151,9 @@ class GitLabClient {
|
|||
// example: <host>/api/v4/projects/<namespace>%2Fbackporting-example/merge_requests/1
|
||||
async getPullRequest(namespace, repo, mrNumber, squash) {
|
||||
const projectId = this.getProjectId(namespace, repo);
|
||||
const { data } = await this.client.get(`/projects/${projectId}/merge_requests/${mrNumber}`);
|
||||
const url = `/projects/${projectId}/merge_requests/${mrNumber}`;
|
||||
this.logger.debug(`Fetching pull request ${url}`);
|
||||
const { data } = await this.client.get(`${url}`);
|
||||
if (squash === undefined) {
|
||||
squash = (0, git_util_1.inferSquash)(data.state === "opened", data.squash_commit_sha);
|
||||
}
|
||||
|
@ -1241,7 +1243,7 @@ class GitLabClient {
|
|||
try {
|
||||
const { namespace, project, id } = this.extractMergeRequestData(mrUrl);
|
||||
const projectId = this.getProjectId(namespace, project);
|
||||
const { data } = await this.client.post(`/projects/${projectId}/issues/${id}/notes`, {
|
||||
const { data } = await this.client.post(`/projects/${projectId}/merge_requests/${id}/notes`, {
|
||||
body: comment,
|
||||
});
|
||||
if (!data) {
|
||||
|
|
6
dist/gha/index.js
vendored
6
dist/gha/index.js
vendored
|
@ -1116,7 +1116,9 @@ class GitLabClient {
|
|||
// example: <host>/api/v4/projects/<namespace>%2Fbackporting-example/merge_requests/1
|
||||
async getPullRequest(namespace, repo, mrNumber, squash) {
|
||||
const projectId = this.getProjectId(namespace, repo);
|
||||
const { data } = await this.client.get(`/projects/${projectId}/merge_requests/${mrNumber}`);
|
||||
const url = `/projects/${projectId}/merge_requests/${mrNumber}`;
|
||||
this.logger.debug(`Fetching pull request ${url}`);
|
||||
const { data } = await this.client.get(`${url}`);
|
||||
if (squash === undefined) {
|
||||
squash = (0, git_util_1.inferSquash)(data.state === "opened", data.squash_commit_sha);
|
||||
}
|
||||
|
@ -1206,7 +1208,7 @@ class GitLabClient {
|
|||
try {
|
||||
const { namespace, project, id } = this.extractMergeRequestData(mrUrl);
|
||||
const projectId = this.getProjectId(namespace, project);
|
||||
const { data } = await this.client.post(`/projects/${projectId}/issues/${id}/notes`, {
|
||||
const { data } = await this.client.post(`/projects/${projectId}/merge_requests/${id}/notes`, {
|
||||
body: comment,
|
||||
});
|
||||
if (!data) {
|
||||
|
|
2
mise.toml
Normal file
2
mise.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[tools]
|
||||
node = "20"
|
|
@ -48,7 +48,9 @@ export default class GitLabClient implements GitClient {
|
|||
// example: <host>/api/v4/projects/<namespace>%2Fbackporting-example/merge_requests/1
|
||||
async getPullRequest(namespace: string, repo: string, mrNumber: number, squash: boolean | undefined): Promise<GitPullRequest> {
|
||||
const projectId = this.getProjectId(namespace, repo);
|
||||
const { data } = await this.client.get(`/projects/${projectId}/merge_requests/${mrNumber}`);
|
||||
const url = `/projects/${projectId}/merge_requests/${mrNumber}`;
|
||||
this.logger.debug(`Fetching pull request ${url}`);
|
||||
const { data } = await this.client.get(`${url}`);
|
||||
|
||||
if (squash === undefined) {
|
||||
squash = inferSquash(data.state === "opened", data.squash_commit_sha);
|
||||
|
@ -169,7 +171,7 @@ export default class GitLabClient implements GitClient {
|
|||
const { namespace, project, id } = this.extractMergeRequestData(mrUrl);
|
||||
const projectId = this.getProjectId(namespace, project);
|
||||
|
||||
const { data } = await this.client.post(`/projects/${projectId}/issues/${id}/notes`, {
|
||||
const { data } = await this.client.post(`/projects/${projectId}/merge_requests/${id}/notes`, {
|
||||
body: comment,
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue