From d8651ca6981ebae0e6ab6f21fb6cff6cde21e3f8 Mon Sep 17 00:00:00 2001 From: Fabrizio Gortani Date: Mon, 12 Jun 2023 10:51:05 +0200 Subject: [PATCH] fix: apply sleep before set the default branch --- scopes/gitlab/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scopes/gitlab/main.go b/scopes/gitlab/main.go index 6235f11..6a1e4c5 100644 --- a/scopes/gitlab/main.go +++ b/scopes/gitlab/main.go @@ -11,6 +11,7 @@ import ( "strconv" "strings" "sync" + "time" ) // The request method perform an HTTP call into gitlab instance using @@ -261,6 +262,10 @@ func (g *gitlab) createMirrorProject(name string, path string, groupID int) erro return err } + // Sleep because sometimes the repo seems not completed yet. + // and the next call explode!! + time.Sleep(2 * time.Second) + endpoint := fmt.Sprintf("/projects/%d/protected_branches/main", mirrorProject.ID) payload := map[string]interface{}{ "allow_force_push": true,