semantic_release.hvcs.gitlab module#

Helper code for interacting with a Gitlab remote VCS

class semantic_release.hvcs.gitlab.Gitlab(remote_url: str, *, hvcs_domain: str | None = None, token: str | None = None, allow_insecure: bool = False, **kwargs: Any)[source]#

Bases: HvcsBase

Gitlab helper class Note Gitlab doesn’t really have the concept of a separate API domain

DEFAULT_DOMAIN = 'gitlab.com'#
DEFAULT_ENV_TOKEN_NAME = 'GITLAB_TOKEN'#
commit_hash_url(commit_hash: str) str[source]#

Given a commit hash, return a web URL which links to this commit in the remote VCS.

compare_url(from_rev: str, to_rev: str) str[source]#

Get the comparison link between two version tags.

Parameters:

from_rev – The older version to compare. Can be a commit sha, tag or

branch name.

Parameters:

to_rev – The newer version to compare. Can be a commit sha, tag or

branch name.

Returns:

Link to view a comparison between the two versions.

create_api_url(endpoint: str, auth: str | None = None, query: str | None = None, fragment: str | None = None) str[source]#
create_or_update_release(tag: str, release_notes: str, prerelease: bool = False) str[source]#

Create or update a release for the given tag in a remote VCS, attaching the given changelog, if supported

create_release(tag: str, release_notes: str, prerelease: bool = False) str[source]#

Post release changelog :param tag: Tag to create release for :param release_notes: The release notes for this version :param prerelease: This parameter has no effect :return: The tag of the release

create_server_url(path: str, auth: str | None = None, query: str | None = None, fragment: str | None = None) str[source]#
edit_release_notes(release_id: str, release_notes: str) str[source]#

Edit the changelog associated with a release, if supported

issue_url(issue_number: str | int) str[source]#
merge_request_url(mr_number: str | int) str[source]#
pull_request_url(pr_number: str | int) str[source]#

Given a number for a PR/Merge request/equivalent, return a web URL that links to that PR in the remote VCS.

remote_url(use_token: bool = True) str[source]#

Get the remote url including the token for authentication if requested