feat: Add repository host Codeberg (#2202)

This commit is contained in:
Remo Senekowitsch 2025-06-20 13:37:49 +02:00 committed by GitHub
parent 4628235403
commit a90dd4569f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 2 deletions

View file

@ -9,6 +9,7 @@ pub enum RepositoryHost {
GitLab,
BitBucket,
SourceForge,
Codeberg,
Unknown,
}
@ -65,6 +66,7 @@ impl RepositoryHost {
Some(domain) if domain.starts_with("gitlab") => GitLab,
Some("bitbucket.org") => BitBucket,
Some("sourceforge.net") => SourceForge,
Some("codeberg.org") => Codeberg,
_ => Unknown,
}
}
@ -95,6 +97,12 @@ impl RepositoryHost {
&[FULL_FILENAMES, NOVERSION_FILENAMES],
"/download",
)),
Codeberg => Some(apply_filenames_to_paths(
// Codeberg (Forgejo) has the same release paths as GitHub.
GITHUB_RELEASE_PATHS,
&[FULL_FILENAMES, NOVERSION_FILENAMES],
"",
)),
Unknown => None,
}
}

View file

@ -290,6 +290,7 @@ impl RepoInfo {
match repository_host {
RepositoryHost::GitHub => Self::detect_subcrate_common(repo, &["tree"]),
RepositoryHost::GitLab => Self::detect_subcrate_common(repo, &["-", "blob"]),
RepositoryHost::Codeberg => Self::detect_subcrate_common(repo, &["src", "branch"]),
_ => None,
}
}