GitLabProvider
Defined in: vcs/gitlab.ts:100
A VcsProvider implementation for GitLab, backed by the GitLab REST API v4.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GitLabProvider(
options):GitLabProvider
Defined in: vcs/gitlab.ts:118
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”GitLabProvider
Methods
Section titled “Methods”branchExists()
Section titled “branchExists()”branchExists(
project,branchName):Promise<boolean>
Defined in: vcs/gitlab.ts:192
Returns whether a branch exists in a project.
Parameters
Section titled “Parameters”project
Section titled “project”branchName
Section titled “branchName”string
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”buildAuthenticatedRemoteUrl()
Section titled “buildAuthenticatedRemoteUrl()”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).
Parameters
Section titled “Parameters”string
projectPath
Section titled “projectPath”string
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”VcsProvider.buildAuthenticatedRemoteUrl
buildChangeRequestUrl()
Section titled “buildChangeRequestUrl()”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/.
Parameters
Section titled “Parameters”projectUrl
Section titled “projectUrl”string
changeRequestIid
Section titled “changeRequestIid”string | number
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”VcsProvider.buildChangeRequestUrl
buildCiCloneUrl()
Section titled “buildCiCloneUrl()”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.
Parameters
Section titled “Parameters”ciJobToken
Section titled “ciJobToken”string
projectPath
Section titled “projectPath”string
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”commitFile()
Section titled “commitFile()”commitFile(
project,branchName,commitMessage,filePath,content):Promise<VcsCommit>
Defined in: vcs/gitlab.ts:217
Commits new content for a single file to a branch.
Parameters
Section titled “Parameters”project
Section titled “project”branchName
Section titled “branchName”string
commitMessage
Section titled “commitMessage”string
filePath
Section titled “filePath”string
content
Section titled “content”string
Returns
Section titled “Returns”Promise<VcsCommit>
Implementation of
Section titled “Implementation of”compareRefs()
Section titled “compareRefs()”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).
Parameters
Section titled “Parameters”project
Section titled “project”string
string
Returns
Section titled “Returns”Promise<VcsCommitLogEntry[]>
Implementation of
Section titled “Implementation of”createBranch()
Section titled “createBranch()”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).
Parameters
Section titled “Parameters”project
Section titled “project”branchName
Section titled “branchName”string
string
Returns
Section titled “Returns”Promise<VcsBranch>
Implementation of
Section titled “Implementation of”createMergeRequest()
Section titled “createMergeRequest()”createMergeRequest(
project,sourceBranch,targetBranch,title,description,labels?):Promise<VcsMergeRequest>
Defined in: vcs/gitlab.ts:253
Creates a new merge/pull request.
Parameters
Section titled “Parameters”project
Section titled “project”sourceBranch
Section titled “sourceBranch”string
targetBranch
Section titled “targetBranch”string
string
description
Section titled “description”string
labels?
Section titled “labels?”string[]
Returns
Section titled “Returns”Promise<VcsMergeRequest>
Implementation of
Section titled “Implementation of”VcsProvider.createMergeRequest
findOpenMergeRequest()
Section titled “findOpenMergeRequest()”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.
Parameters
Section titled “Parameters”project
Section titled “project”sourceBranch
Section titled “sourceBranch”string
targetBranch
Section titled “targetBranch”string
Returns
Section titled “Returns”Promise<VcsMergeRequest | undefined>
Implementation of
Section titled “Implementation of”VcsProvider.findOpenMergeRequest
getCiContext()
Section titled “getCiContext()”getCiContext():
VcsCiContext
Defined in: vcs/gitlab.ts:132
Reads the upstream repository’s identity from this platform’s CI environment variables.
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”getFileContent()
Section titled “getFileContent()”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.
Parameters
Section titled “Parameters”project
Section titled “project”filePath
Section titled “filePath”string
string
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”getProjectVariables()
Section titled “getProjectVariables()”getProjectVariables(
project):Promise<VcsProjectVariable[]>
Defined in: vcs/gitlab.ts:295
Fetches project/repo-level CI variables. Returns an empty array if unreadable.
Parameters
Section titled “Parameters”project
Section titled “project”Returns
Section titled “Returns”Promise<VcsProjectVariable[]>
Implementation of
Section titled “Implementation of”VcsProvider.getProjectVariables
listProjects()
Section titled “listProjects()”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.
Parameters
Section titled “Parameters”groupId
Section titled “groupId”string | number
Returns
Section titled “Returns”Promise<VcsProject[]>
Implementation of
Section titled “Implementation of”updateMergeRequest()
Section titled “updateMergeRequest()”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.
Parameters
Section titled “Parameters”project
Section titled “project”mergeRequest
Section titled “mergeRequest”string
description
Section titled “description”string
labels?
Section titled “labels?”string[]
Returns
Section titled “Returns”Promise<VcsMergeRequest>
Implementation of
Section titled “Implementation of”VcsProvider.updateMergeRequest
Properties
Section titled “Properties”apiUrl
Section titled “apiUrl”
readonlyapiUrl:string
Defined in: vcs/gitlab.ts:114
The API base URL this provider talks to, derived from the host unless overridden.
Implementation of
Section titled “Implementation of”
readonlyhost:string
Defined in: vcs/gitlab.ts:112
The instance hostname this provider was built for.
Implementation of
Section titled “Implementation of”
readonlykind:"gitlab"
Defined in: vcs/gitlab.ts:104
Implementation of
Section titled “Implementation of”terminology
Section titled “terminology”
readonlyterminology:VcsTerminology
Defined in: vcs/gitlab.ts:106
The platform’s vocabulary, for composing user-facing text.
Implementation of
Section titled “Implementation of”defaultHost
Section titled “defaultHost”
readonlystaticdefaultHost:"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.