Add GetCommitViewerURL to Forge

This commit is contained in:
Mustafa Gezen 2023-08-28 16:57:22 +02:00
parent 3a417acff0
commit 13207458f0
Signed by: mustafa
GPG Key ID: DCDF010D946438C1
2 changed files with 10 additions and 0 deletions

View File

@ -18,5 +18,6 @@ type Authenticator struct {
type Forge interface {
GetAuthenticator() (*Authenticator, error)
GetRemote() string
GetCommitViewerURL(repo string, commit string) string
EnsureRepositoryExists(auth *Authenticator, repo string) error
}

View File

@ -168,6 +168,15 @@ func (f *Forge) GetRemote() string {
return fmt.Sprintf("https://github.com/%s", f.organization)
}
func (f *Forge) GetCommitViewerURL(repo string, commit string) string {
return fmt.Sprintf(
"https://github.com/%s/%s/commit/%s",
f.organization,
repo,
commit,
)
}
func (f *Forge) EnsureRepositoryExists(auth *forge.Authenticator, repo string) error {
// Cast AuthMethod to BasicAuth
basicAuth := auth.AuthMethod.(*transport_http.BasicAuth)