Skip to content

Commit 6736b87

Browse files
committed
chore(tools): ignore error if pull request has no change
1 parent 7df308e commit 6736b87

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

tools/shared/github.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package shared
22

33
import (
44
"context"
5-
"fmt"
65
"os"
76
"strings"
87

@@ -39,13 +38,11 @@ func CreatePullRequest(ctx context.Context, client *github.Client, owner, repo s
3938
branch := "refs/heads/" + *pr.Head
4039
_, _, err := client.PullRequests.Create(ctx, owner, repo, &pr)
4140
if err, ok := err.(*github.ErrorResponse); ok {
41+
// Clean up PR branch if no change
4242
for _, e := range err.Errors {
4343
if strings.HasPrefix(e.Message, "No commits between") {
44-
// Clean up PR branch
45-
if _, err := client.Git.DeleteRef(ctx, owner, repo, "refs/heads/"+branch); err != nil {
46-
fmt.Fprintln(os.Stderr, err)
47-
break
48-
}
44+
_, err := client.Git.DeleteRef(ctx, owner, repo, "refs/heads/"+branch)
45+
return err
4946
}
5047
}
5148
}

0 commit comments

Comments
 (0)