chore: Remove gitbeaker dep on client (#11517)

Add dupe detection to gitlab install
This commit is contained in:
Tom Moor
2026-02-22 00:38:10 -05:00
committed by GitHub
parent 46dd13fc7f
commit 496b89c7f8
5 changed files with 24 additions and 67 deletions
-66
View File
@@ -1,4 +1,3 @@
import { Gitlab } from "@gitbeaker/rest";
import env from "@shared/env";
import { integrationSettingsPath } from "@shared/utils/routeHelpers";
import { UnfurlResourceType } from "@shared/types";
@@ -97,20 +96,6 @@ export class GitLabUtils {
return `${this.url}?install_request=true`;
}
/**
* Creates a Gitbeaker client instance.
*
* @param accessToken - The access token for authentication.
* @param customUrl - Optional custom GitLab URL from integration settings.
* @returns A configured Gitbeaker client.
*/
public static createClient(accessToken: string, customUrl?: string) {
return new Gitlab({
host: this.getGitlabUrl(customUrl),
oauthToken: accessToken,
});
}
/**
* Parses a GitLab URL and extracts resource identifiers.
*
@@ -192,57 +177,6 @@ export class GitLabUtils {
};
}
/**
* Fetches an issue from a GitLab project.
*
* @param accessToken - The access token for authentication.
* @param projectPath - The project path (owner/repo).
* @param issueIid - The issue IID (internal ID within the project).
* @param customUrl - Optional custom GitLab URL from integration settings.
* @returns The issue data.
*/
public static async getIssue(
accessToken: string,
projectPath: string,
issueIid: number,
customUrl?: string
) {
const client = this.createClient(accessToken, customUrl);
const issues = await client.Issues.all({
projectId: projectPath,
iids: [issueIid],
withLabelsDetails: true,
});
if (!issues || issues.length === 0) {
throw new Error(`Issue ${issueIid} not found in project ${projectPath}`);
}
return issues[0];
}
/**
* Fetches a merge request from a GitLab project.
*
* @param accessToken - The access token for authentication.
* @param projectPath - The project path (owner/repo).
* @param mrIid - The merge request IID (internal ID within the project).
* @param customUrl - Optional custom GitLab URL from integration settings.
* @returns The merge request data.
*/
public static async getMergeRequest(
accessToken: string,
projectPath: string,
mrIid: number,
customUrl?: string
) {
const client = this.createClient(accessToken, customUrl);
// MergeRequests.show properly accepts projectId and mergerequestIId
const mr = await client.MergeRequests.show(projectPath, mrIid);
return mr;
}
/**
* Returns the color associated with a given status.
*