Skip to content

Commit

Permalink
gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
benpankow committed May 7, 2024
1 parent 4e1ad1b commit b5206d2
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,21 @@ def _build_github_url(url: str, branch: str) -> str:
return f"{url}/tree/{branch}"


def _build_gitlab_url(url: str, branch: str) -> str:
return f"{url}/-/tree/{branch}"


@experimental
def link_to_source_control(
assets_defs: Sequence[Union["AssetsDefinition", "SourceAsset", "CacheableAssetsDefinition"]],
source_control_url: str,
source_control_branch: str,
repository_root_absolute_path: Union[Path, str],
) -> Sequence[Union["AssetsDefinition", "SourceAsset", "CacheableAssetsDefinition"]]:
if source_control_url and "github.com/" in source_control_url:
if "gitlab.com" in source_control_url:
source_control_url = _build_gitlab_url(source_control_url, source_control_branch)
else:
# assume GitHub URL scheme
source_control_url = _build_github_url(source_control_url, source_control_branch)

return [
Expand Down

0 comments on commit b5206d2

Please sign in to comment.