1
1
mirror of https://github.com/cooperspencer/gickup synced 2024-11-08 12:09:18 +01:00

create orgs for gitea with 'createorg: true'

This commit is contained in:
Andreas Wachter 2022-10-30 22:42:23 +01:00
parent 0967462c1a
commit 8a84f57965
2 changed files with 19 additions and 4 deletions

@ -33,11 +33,25 @@ func Backup(r types.Repo, d types.GenRepo, dry bool) {
if d.User != "" {
user, _, err = giteaclient.GetUserInfo(d.User)
if err != nil {
log.Fatal().
Str("stage", "gitea").
Str("url", d.URL).
Msg(err.Error())
if d.CreateOrg {
_, _, err = giteaclient.CreateOrg(gitea.CreateOrgOption{
Name: d.User,
Visibility: gitea.VisibleTypePrivate,
})
if err != nil {
log.Fatal().
Str("stage", "gitea").
Str("url", d.URL).
Msg(err.Error())
}
} else {
log.Fatal().
Str("stage", "gitea").
Str("url", d.URL).
Msg(err.Error())
}
}
}
if dry {

@ -197,6 +197,7 @@ type GenRepo struct {
IncludeOrgs []string `yaml:"includeorgs"`
Wiki bool `yaml:"wiki"`
Starred bool `yaml:"starred"`
CreateOrg bool `yaml:"createorg"`
}
// GetToken TODO.