isSameRef checks if the head and base refs point to the same ref in the same repository. For cross-repository PRs (e.g., from a fork), the qualified head ref will contain an owner prefix (owner:branch), so even if branch names match, they refer to different repos.
(refs creationRefs)
| 176 | // For cross-repository PRs (e.g., from a fork), the qualified head ref will contain |
| 177 | // an owner prefix (owner:branch), so even if branch names match, they refer to different repos. |
| 178 | func isSameRef(refs creationRefs) bool { |
| 179 | if strings.Contains(refs.QualifiedHeadRef(), ":") { |
| 180 | return false |
| 181 | } |
| 182 | return refs.UnqualifiedHeadRef() == refs.BaseRef() |
| 183 | } |
| 184 | |
| 185 | // CreateContext stores contextual data about the creation process and is for building up enough |
| 186 | // data to create a pull request. |