Sourcehut (#123)

* added createorg to gogs

* added sourcehut capabilities

* fix variable names

* added sourcehut to readme
This commit is contained in:
Andreas Wachter 2022-11-16 08:09:33 +01:00 committed by GitHub
parent 8a84f57965
commit fa2dfd4434
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 348 additions and 4 deletions

View file

@ -26,10 +26,24 @@ func Backup(r types.Repo, d types.GenRepo, dry bool) {
if d.User != "" {
user, err = gogsclient.GetUserInfo(d.User)
if err != nil {
log.Fatal().
Str("stage", "gogs").
Str("url", d.URL).
Msgf("couldn't find %s", d.User)
if d.CreateOrg {
org, err := gogsclient.CreateOrg(gogs.CreateOrgOption{
UserName: d.User,
})
if err != nil {
log.Fatal().
Str("stage", "gogs").
Str("url", d.URL).
Msg(err.Error())
}
user.ID = org.ID
user.UserName = org.UserName
} else {
log.Fatal().
Str("stage", "gogs").
Str("url", d.URL).
Msg(err.Error())
}
}
}