diff --git a/pkg/build/cmd/enterprisecheck.go b/pkg/build/cmd/enterprisecheck.go index 396c123df2d..f2c36b0fc2e 100644 --- a/pkg/build/cmd/enterprisecheck.go +++ b/pkg/build/cmd/enterprisecheck.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "log" "os" "strconv" @@ -113,9 +115,11 @@ func completeEnterpriseCheck(c *cli.Context, success bool) error { } // Delete branch if needed + log.Printf("Checking branch '%s' against '%s'", git.PRCheckRegexp().String(), opts.Branch) if git.PRCheckRegexp().MatchString(opts.Branch) { + log.Println("Deleting branch", opts.Branch) if err := git.DeleteEnterpriseBranch(ctx, client.Git, opts.Branch); err != nil { - return nil + return fmt.Errorf("error deleting enterprise branch: %w", err) } } diff --git a/pkg/build/git/git.go b/pkg/build/git/git.go index 518a2c6bf7a..7539a815de6 100644 --- a/pkg/build/git/git.go +++ b/pkg/build/git/git.go @@ -105,8 +105,7 @@ func AddLabelToPR(ctx context.Context, client LabelsService, prID int, newLabel func DeleteEnterpriseBranch(ctx context.Context, client GitService, branchName string) error { ref := "heads/" + branchName - _, err := client.DeleteRef(ctx, RepoOwner, EnterpriseRepo, ref) - if err != nil { + if _, err := client.DeleteRef(ctx, RepoOwner, EnterpriseRepo, ref); err != nil { return err }