Skip to content

Commit

Permalink
fix(notifications): support gitlab nested projects for FullNameByRepoURL
Browse files Browse the repository at this point in the history
Signed-off-by: Zadkiel Aharonian <[email protected]>
  • Loading branch information
aslafy-z committed Dec 5, 2023
1 parent 7484f1d commit 71b79d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/operator-manual/notifications/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Transforms given GIT URL into HTTPs format.
<hr>
**`repo.FullNameByRepoURL(url string) string`**

Returns repository URL full name `(<owner>/<repoName>)`. Currently supports only Github, GitLab and Bitbucket.
Returns repository URL full name `(<group>/[<nestedGroup...>/]<repoName>)`. Currently supports only Github, GitLab and Bitbucket.

<hr>
**`repo.GetCommitMetadata(sha string) CommitMetadata`**
Expand Down
7 changes: 2 additions & 5 deletions util/notification/expression/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,8 @@ func FullNameByRepoURL(rawURL string) string {
}

path := gitSuffix.ReplaceAllString(parsed.Path, "")
if pathParts := text.SplitRemoveEmpty(path, "/"); len(pathParts) >= 2 {
return strings.Join(pathParts[:2], "/")
}

return path
pathParts := text.SplitRemoveEmpty(path, "/")
return strings.Join(pathParts, "/")
}

func repoURLToHTTPS(rawURL string) string {
Expand Down

0 comments on commit 71b79d2

Please sign in to comment.