@@ -184,17 +184,17 @@ func statusRun(opts *StatusOptions) error {
184184 return nil
185185}
186186
187- func prSelectorForCurrentBranch (gitClient * git.Client , baseRepo ghrepo.Interface , prHeadRef string , rem ghContext.Remotes ) (prNumber int , selector string , err error ) {
188- selector = prHeadRef
187+ func prSelectorForCurrentBranch (gitClient * git.Client , baseRepo ghrepo.Interface , prHeadRef string , rem ghContext.Remotes ) (int , string , error ) {
189188 branchConfig , _ := gitClient .ReadBranchConfig (context .Background (), prHeadRef )
190189
191190 // the branch is configured to merge a special PR head ref
192191 prHeadRE := regexp .MustCompile (`^refs/pull/(\d+)/head$` )
193192 if m := prHeadRE .FindStringSubmatch (branchConfig .MergeRef ); m != nil {
194- prNumber , _ = strconv .Atoi (m [1 ])
195- return
193+ prNumber , err : = strconv .Atoi (m [1 ])
194+ return prNumber , prHeadRef , err
196195 }
197196
197+ var err error
198198 var branchOwner string
199199 if branchConfig .RemoteURL != nil {
200200 // the branch merges from a remote specified by URL
@@ -208,6 +208,7 @@ func prSelectorForCurrentBranch(gitClient *git.Client, baseRepo ghrepo.Interface
208208 }
209209 }
210210
211+ selector := prHeadRef
211212 if branchOwner != "" {
212213 if strings .HasPrefix (branchConfig .MergeRef , "refs/heads/" ) {
213214 selector = strings .TrimPrefix (branchConfig .MergeRef , "refs/heads/" )
@@ -218,7 +219,7 @@ func prSelectorForCurrentBranch(gitClient *git.Client, baseRepo ghrepo.Interface
218219 }
219220 }
220221
221- return
222+ return 0 , selector , err
222223}
223224
224225func totalApprovals (pr * api.PullRequest ) int {
0 commit comments