Skip to content

Commit 0d05fbe

Browse files
authored
Skip branches without PRs (#571)
1 parent 69a4e52 commit 0d05fbe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/actions/pr.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,13 @@ func UpdatePullRequestWithStack(
900900
tx meta.WriteTx,
901901
branchName string,
902902
) error {
903-
branchMeta, _ := tx.Branch(branchName)
903+
branchMeta, exists := tx.Branch(branchName)
904+
// it's possible that this branch is not part of the primary stack, ex: they have main->branchA->branchB,
905+
// but forkA is coming from branchA in which case forkA may not have a pull request associated with it.
906+
// In this case, we should not try to update forkA's pull request with the stack.
907+
if !exists || branchMeta.PullRequest == nil {
908+
return nil
909+
}
904910
logrus.WithField("branch", branchName).
905911
WithField("pr", branchMeta.PullRequest.ID).
906912
Debug("Updating pull requests with stack")

0 commit comments

Comments
 (0)