mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CI: add log for branch deletion (#60647)
* add log for branch deletion * return an err when branch deletion fails
This commit is contained in:
parent
a16ca209fb
commit
dc00f6dbe3
@ -1,6 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@ -113,9 +115,11 @@ func completeEnterpriseCheck(c *cli.Context, success bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete branch if needed
|
// Delete branch if needed
|
||||||
|
log.Printf("Checking branch '%s' against '%s'", git.PRCheckRegexp().String(), opts.Branch)
|
||||||
if git.PRCheckRegexp().MatchString(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 {
|
if err := git.DeleteEnterpriseBranch(ctx, client.Git, opts.Branch); err != nil {
|
||||||
return nil
|
return fmt.Errorf("error deleting enterprise branch: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,8 +105,7 @@ func AddLabelToPR(ctx context.Context, client LabelsService, prID int, newLabel
|
|||||||
|
|
||||||
func DeleteEnterpriseBranch(ctx context.Context, client GitService, branchName string) error {
|
func DeleteEnterpriseBranch(ctx context.Context, client GitService, branchName string) error {
|
||||||
ref := "heads/" + branchName
|
ref := "heads/" + branchName
|
||||||
_, err := client.DeleteRef(ctx, RepoOwner, EnterpriseRepo, ref)
|
if _, err := client.DeleteRef(ctx, RepoOwner, EnterpriseRepo, ref); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user