Skip to content

Commit

Permalink
fix(github): ignore branch deletion error if branch is already deleted (
Browse files Browse the repository at this point in the history
  • Loading branch information
lindell committed Sep 29, 2021
1 parent 633a2cc commit d63d041
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/scm/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,13 @@ func (g Github) MergePullRequest(ctx context.Context, pullReq git.PullRequest) e
}

_, err = g.ghClient.Git.DeleteRef(ctx, pr.prOwnerName, pr.prRepoName, fmt.Sprintf("heads/%s", pr.branchName))
return err

// Ignore errors about the reference not existing since it may be the case that GitHub has already deleted the branch
if err != nil && !strings.Contains(err.Error(), "Reference does not exist") {
return err
}

return nil
}

// ClosePullRequest closes a pull request
Expand Down

0 comments on commit d63d041

Please sign in to comment.