add a check for all repos on master

This commit is contained in:
Jeff Carr 2025-08-17 23:44:46 -05:00
parent 0de26aee43
commit 25cee2b013
1 changed files with 28 additions and 0 deletions

28
branches.go Normal file
View File

@ -0,0 +1,28 @@
package forgepb
import "go.wit.com/log"
var ErrorNotAllReposOnMaster error = log.Errorf("not all repos on are on the master branch")
var ErrorNotAllReposOnDevel error = log.Errorf("not all repos on are on the devel branch")
var ErrorNotAllReposOnUser error = log.Errorf("not all repos on are on the user branch")
func (f *Forge) IsEverythingOnMaster() (int, int, int, error) {
var total int
var count int
var nope int
// first make sure every repo is on the master branch
for repo := range f.Repos.IterAll() {
total += 1
if repo.GetMasterBranchName() == repo.GetCurrentBranchName() {
count += 1
} else {
nope += 1
}
}
if total != count {
// log.Info(ErrorNotAllReposOnMaster)
return total, count, nope, ErrorNotAllReposOnMaster
}
return total, count, nope, nil
}