Skip to content

Commit

Permalink
feat: add codeberg SCM
Browse files Browse the repository at this point in the history
Codeberg SCM follows GitHub structures AND also exposes the go meta head. In order to avoid unnecessary network calls, just implement the corresponding regex

Signed-off-by: grouville <guillaume@dagger.io>
  • Loading branch information
grouville committed May 31, 2024
1 parent abaf5ea commit 9fcec2a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,15 @@ var vcsPaths = []*vcsPath{
check: noVCSSuffix,
},

// Codeberg
{
prefix: "codeberg.org/",
re: `^(?P<root>codeberg\.org/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[\p{L}0-9_.\-]+)*$`,
vcs: "git",
repo: "https://{root}",
check: noVCSSuffix,
},

// Bitbucket
{
prefix: "bitbucket.org/",
Expand Down
7 changes: 7 additions & 0 deletions vcs/vcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ func TestRepoRootForImportPath(t *testing.T) {
Repo: "https://bitbucket.org/workspace/pkgname",
},
},
{
"codeberg.org/workspace/pkgname/subdir",
&RepoRoot{
VCS: vcsGit,
Repo: "https://codeberg.org/workspace/pkgname",
},
},
}

for _, test := range tests {
Expand Down

0 comments on commit 9fcec2a

Please sign in to comment.