Skip to content

GitLabProvider

Defined in: vcs/gitlab.ts:100

A VcsProvider implementation for GitLab, backed by the GitLab REST API v4.

new GitLabProvider(options): GitLabProvider

Defined in: vcs/gitlab.ts:118

VcsProviderOptions

GitLabProvider

branchExists(project, branchName): Promise<boolean>

Defined in: vcs/gitlab.ts:192

Returns whether a branch exists in a project.

VcsProjectRef

string

Promise<boolean>

VcsProvider.branchExists


buildAuthenticatedRemoteUrl(token, projectPath): string

Defined in: vcs/gitlab.ts:312

Builds a token-authenticated remote URL suitable for push/tag operations (e.g. git remote add).

string

string

string

VcsProvider.buildAuthenticatedRemoteUrl


buildChangeRequestUrl(projectUrl, changeRequestIid): string

Defined in: vcs/gitlab.ts:308

Builds the browser URL for a merge/pull request, given the project’s own web URL. The path differs per platform — GitLab nests it under /-/merge_requests/, GitHub under /pull/.

string

string | number

string

VcsProvider.buildChangeRequestUrl


buildCiCloneUrl(ciJobToken, projectPath): string

Defined in: vcs/gitlab.ts:316

Builds a CI-job-token-authenticated remote URL suitable for a read-only git clone.

string

string

string

VcsProvider.buildCiCloneUrl


commitFile(project, branchName, commitMessage, filePath, content): Promise<VcsCommit>

Defined in: vcs/gitlab.ts:217

Commits new content for a single file to a branch.

VcsProjectRef

string

string

string

string

Promise<VcsCommit>

VcsProvider.commitFile


compareRefs(project, from, to): Promise<VcsCommitLogEntry[]>

Defined in: vcs/gitlab.ts:184

Lists the commits reachable from to but not from from (e.g. between two tags/SHAs).

VcsProjectRef

string

string

Promise<VcsCommitLogEntry[]>

VcsProvider.compareRefs


createBranch(project, branchName, ref): Promise<VcsBranch>

Defined in: vcs/gitlab.ts:207

Creates a branch from a reference point (usually the project’s default branch).

VcsProjectRef

string

string

Promise<VcsBranch>

VcsProvider.createBranch


createMergeRequest(project, sourceBranch, targetBranch, title, description, labels?): Promise<VcsMergeRequest>

Defined in: vcs/gitlab.ts:253

Creates a new merge/pull request.

VcsProjectRef

string

string

string

string

string[]

Promise<VcsMergeRequest>

VcsProvider.createMergeRequest


findOpenMergeRequest(project, sourceBranch, targetBranch): Promise<VcsMergeRequest | undefined>

Defined in: vcs/gitlab.ts:239

Finds an existing open merge/pull request with the given source and target branch, if any.

VcsProjectRef

string

string

Promise<VcsMergeRequest | undefined>

VcsProvider.findOpenMergeRequest


getCiContext(): VcsCiContext

Defined in: vcs/gitlab.ts:132

Reads the upstream repository’s identity from this platform’s CI environment variables.

VcsCiContext

VcsProvider.getCiContext


getFileContent(project, filePath, ref): Promise<string>

Defined in: vcs/gitlab.ts:176

Fetches the raw content of a file from a project at a given ref.

VcsProjectRef

string

string

Promise<string>

VcsProvider.getFileContent


getProjectVariables(project): Promise<VcsProjectVariable[]>

Defined in: vcs/gitlab.ts:295

Fetches project/repo-level CI variables. Returns an empty array if unreadable.

VcsProjectRef

Promise<VcsProjectVariable[]>

VcsProvider.getProjectVariables


listProjects(groupId): Promise<VcsProject[]>

Defined in: vcs/gitlab.ts:139

Lists all projects/repos under a group/org, including subgroups where the platform has them.

string | number

Promise<VcsProject[]>

VcsProvider.listProjects


updateMergeRequest(project, mergeRequest, title, description, labels?): Promise<VcsMergeRequest>

Defined in: vcs/gitlab.ts:278

Updates an existing merge/pull request’s title, description, and labels.

VcsProjectRef

VcsMergeRequest

string

string

string[]

Promise<VcsMergeRequest>

VcsProvider.updateMergeRequest

readonly apiUrl: string

Defined in: vcs/gitlab.ts:114

The API base URL this provider talks to, derived from the host unless overridden.

VcsProvider.apiUrl


readonly host: string

Defined in: vcs/gitlab.ts:112

The instance hostname this provider was built for.

VcsProvider.host


readonly kind: "gitlab"

Defined in: vcs/gitlab.ts:104

VcsProvider.kind


readonly terminology: VcsTerminology

Defined in: vcs/gitlab.ts:106

The platform’s vocabulary, for composing user-facing text.

VcsProvider.terminology


readonly static defaultHost: "gitlab.com" = 'gitlab.com'

Defined in: vcs/gitlab.ts:102

Used when no --vcs-host is supplied, so selecting a provider is enough to reach its SaaS instance.