From b33eb154f020b8631e006330e2ec28aa998a321c Mon Sep 17 00:00:00 2001 From: Shravan Konduru <42595673+shravan1k@users.noreply.github.com> Date: Tue, 28 Jun 2022 14:08:25 -0700 Subject: [PATCH] Remove 422 error logging (#323) --- bulldozer/merge.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bulldozer/merge.go b/bulldozer/merge.go index 4f3d9a044..896e17cf6 100644 --- a/bulldozer/merge.go +++ b/bulldozer/merge.go @@ -103,7 +103,11 @@ func (m *GitHubMerger) defaultMerge(ctx context.Context, pullCtx pull.Context, m func (m *GitHubMerger) DeleteHead(ctx context.Context, pullCtx pull.Context) error { _, head := pullCtx.Branches() - _, err := m.client.Git.DeleteRef(ctx, pullCtx.Owner(), pullCtx.Repo(), fmt.Sprintf("refs/heads/%s", head)) + resp, err := m.client.Git.DeleteRef(ctx, pullCtx.Owner(), pullCtx.Repo(), fmt.Sprintf("refs/heads/%s", head)) + // Disregard the error since Github may delete the branch before we do + if resp.StatusCode == http.StatusUnprocessableEntity { + return nil + } return errors.WithStack(err) }