You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-07-05 00:59:04 +02:00
fix: failing when pull_request.base is empty (#4261)
if the base branch is empty, it'll try to fetch the default branch, which would fail if base repo name/owner are also empty. the default behavior when base owner/name are missing is to using head's, so I changed it do that before trying to get the default branch, which should fix the issue.
This commit is contained in:
committed by
GitHub
parent
94a65fcda1
commit
ec0df9ecd5
@ -196,6 +196,8 @@ func (c *githubClient) OpenPullRequest(
|
||||
draft bool,
|
||||
) error {
|
||||
c.checkRateLimit(ctx)
|
||||
base.Owner = firstNonEmpty(base.Owner, head.Owner)
|
||||
base.Name = firstNonEmpty(base.Name, head.Name)
|
||||
if base.Branch == "" {
|
||||
def, err := c.getDefaultBranch(ctx, base)
|
||||
if err != nil {
|
||||
@ -217,8 +219,8 @@ func (c *githubClient) OpenPullRequest(
|
||||
log.Info("opening pull request")
|
||||
pr, res, err := c.client.PullRequests.Create(
|
||||
ctx,
|
||||
firstNonEmpty(base.Owner, head.Owner),
|
||||
firstNonEmpty(base.Name, head.Name),
|
||||
base.Owner,
|
||||
base.Name,
|
||||
&github.NewPullRequest{
|
||||
Title: github.String(title),
|
||||
Base: github.String(base.Branch),
|
||||
|
Reference in New Issue
Block a user