This commit is contained in:
2024-09-12 14:15:59 +02:00
parent dd316e20b7
commit d828467d25
2 changed files with 11 additions and 9 deletions

View File

@@ -68,6 +68,7 @@ func processRepositoryAction(h *common.RequestHandler) error {
for _, config := range configs {
if config.GitProjectName == action.Repository.Name {
h.StdLogger.Println("+ ignoring repo event for PrjGit repository", config.GitProjectName)
return nil
}
}
@@ -128,6 +129,7 @@ func processPushAction(h *common.RequestHandler) error {
for _, config := range configs {
if config.GitProjectName == action.Repository.Name {
h.StdLogger.Println("+ ignoring push to PrjGit repository", config.GitProjectName)
return nil
}
}
@@ -170,7 +172,7 @@ func processConfiguredPushAction(h *common.RequestHandler, action *common.PushWe
}
}
h.StdLogger.Println("push of refs not on the main branch. ignoring.")
h.StdLogger.Println("push of refs the configured branch", config.Branch, ". ignoring.")
return nil
}
@@ -268,12 +270,13 @@ next_repo:
for _, c := range configs {
if c.Organization == orgName && c.GitProjectName == r.Name {
// ignore project gits
break
continue next_repo
}
}
for repo := range sub {
if repo == r.Name {
// not missing
continue next_repo
}
}
@@ -282,17 +285,17 @@ next_repo:
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, 1); err != nil {
// assumption that package does not exist, so not part of project
// https://github.com/go-gitea/gitea/issues/31976
break
continue
}
// add repository to git project
common.PanicOnError(git.GitExec(config.GitProjectName, "submodule", "--quiet", "add", "--depth", "1", r.SSHURL))
common.PanicOnError(git.GitExec(config.GitProjectName, "submodule", "--quiet", "add", "--depth", "1", r.SSHURL, r.Name))
if len(config.Branch) > 0 {
common.PanicOnError(git.GitExec(path.Join(config.GitProjectName, r.Name), "fetch", "--depth", "1", "origin", config.Branch))
common.PanicOnError(git.GitExec(path.Join(config.GitProjectName, r.Name), "fetch", "--depth", "1", "origin", config.Branch+":"+config.Branch))
common.PanicOnError(git.GitExec(path.Join(config.GitProjectName, r.Name), "checkout", config.Branch))
}