@@ -238,10 +238,51 @@ func prSelectorForCurrentBranch(branchConfig git.BranchConfig, baseRepo ghrepo.I
238238 }
239239 return 0 , selector , nil
240240 }
241-
242241 return 0 , prHeadRef , nil
243242}
244243
244+ // func prSelectorForCurrentBranch(branchConfig git.BranchConfig, baseRepo ghrepo.Interface, prHeadRef string, _ ghContext.Remotes) (int, string, error) {
245+ // // the branch is configured to merge a special PR head ref, which requires no disambiguation
246+ // prHeadRE := regexp.MustCompile(`^refs/pull/(\d+)/head$`)
247+ // if m := prHeadRE.FindStringSubmatch(branchConfig.MergeRef); m != nil {
248+ // prNumber, err := strconv.Atoi(m[1])
249+ // if err != nil {
250+ // return 0, "", err
251+ // }
252+ // return prNumber, prHeadRef, nil
253+ // }
254+
255+ // // If the BranchConfig.Push revision has resolved, it should correctly point to the PR's selector ref
256+ // if branchConfig.Push != "" {
257+ // return 0, branchConfig.Push, nil
258+ // }
259+
260+ // selector := prHeadRef
261+
262+ // // Without the BranchConfig.Push revision ref, we construct the selector from the PushRemoteName determined by ReadBranchConfig
263+ // var branchOwner string
264+ // if branchConfig.PushRemoteName != "" {
265+ // selector = strings.Join([]string{branchConfig.PushRemoteName, prHeadRef}, "/")
266+ // } else if branchConfig.PushRemoteURL != nil {
267+ // r, err := ghrepo.FromURL(branchConfig.PushRemoteURL)
268+ // if err != nil {
269+ // // TODO: We aren't returning the error because we discovered that it was shadowed
270+ // // before refactoring to its current return pattern. Thus, we aren't confident
271+ // // that returning the error won't break existing behavior.
272+ // return 0, prHeadRef, nil
273+ // }
274+ // branchOwner := r.RepoOwner()
275+ // selector = strings.Join([]string{branchOwner, prHeadRef}, "/")
276+ // }
277+
278+ // // prepend `OWNER:` if this branch is pushed to a fork
279+ // if !strings.EqualFold(branchOwner, baseRepo.RepoOwner()) {
280+ // selector = fmt.Sprintf("%s:%s", branchOwner, selector)
281+ // }
282+
283+ // return 0, strings.Trim(selector, "/"), nil
284+ // }
285+
245286func totalApprovals (pr * api.PullRequest ) int {
246287 approvals := 0
247288 for _ , review := range pr .LatestReviews .Nodes {
0 commit comments