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)
| 171 | // For cross-repository PRs (e.g., from a fork), the qualified head ref will contain |
| 172 | // an owner prefix (owner:branch), so even if branch names match, they refer to different repos. |
| 173 | func isSameRef(refs creationRefs) bool { |
| 174 | if strings.Contains(refs.QualifiedHeadRef(), ":") { |
| 175 | return false |
| 176 | } |
| 177 | return refs.UnqualifiedHeadRef() == refs.BaseRef() |
| 178 | } |
| 179 | |
| 180 | // CreateContext stores contextual data about the creation process and is for building up enough |
| 181 | // data to create a pull request. |