This commit is contained in:
Adam Majer 2024-09-05 15:28:08 +02:00
parent b7f5eb6d50
commit 8a1bbbe3b8
2 changed files with 29 additions and 2 deletions

View File

@ -152,6 +152,7 @@ func (gitea *GiteaTransport) GetOrganizationRepositories(orgName string) ([]*mod
} }
repos = append(repos, ret.Payload...) repos = append(repos, ret.Payload...)
page++
} }
return repos, nil return repos, nil

View File

@ -251,19 +251,41 @@ func verifyProjectState(git *common.GitHandler, orgName string, config *common.A
} }
// find all missing repositories, and add them // find all missing repositories, and add them
if debugMode {
log.Println("checking for missing repositories...")
}
repos, err := gitea.GetOrganizationRepositories(orgName) repos, err := gitea.GetOrganizationRepositories(orgName)
if err != nil { if err != nil {
return err return err
} }
next_repo: if debugMode {
log.Println(" nRepos:", len(repos))
}
next_repo:
for _, r := range repos { for _, r := range repos {
if debugMode {
log.Println(" -- checking", r.Name)
}
for _, c := range configs { for _, c := range configs {
if c.Organization == orgName && c.GitProjectName == r.Name { if c.Organization == orgName && c.GitProjectName == r.Name {
break next_repo // ignore project gits
break
} }
} }
for repo := range sub {
if repo == r.Name {
continue next_repo
}
}
if debugMode {
log.Println(" -- checking repository:", r.Name)
}
if _, err := gitea.GetRecentCommits(orgName, r.Name, config.Branch, 10); err != nil { if _, err := gitea.GetRecentCommits(orgName, r.Name, config.Branch, 10); err != nil {
// assumption that package does not exist, so not part of project // assumption that package does not exist, so not part of project
// https://github.com/go-gitea/gitea/issues/31976 // https://github.com/go-gitea/gitea/issues/31976
@ -296,6 +318,10 @@ next_repo:
} }
} }
if debugMode {
log.Println("Verification finished for ", orgName, ", config", config.GitProjectName)
}
return nil return nil
} }