Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[spike] Automatically detect the PR branch the user is on #2161
Conversation
This implementation uses ListReferences rather than a GitHub API.
The PR associated with the current branch is only highlighted when the user created or opened the PR using GitHub for Visual Studio. This isn't very helpful for users who are new to the extension.
What this PR does
This spike attempts to look up the PR associated with the current branch if the branch hasn't already been tagged. It uses the simple approach of matching
refs/heads/<name>references withrefs/pull/xxx/headreferences. This approach has worked well for https://github.com/jcansdale/GitPullRequest.Challenges
There are issues with spam PRs, where an external user creates a PR from an existing branch in the target repository. For example, a user might create a PR from the
masterbranch in a repository. The owner of the repository is likely to close the spam PR, but won't delete themasterbranch! Unfortunately the above approach can detect deleted branches but no closed PRs.Todo
Implement this using the GraphQL API so we can detect and ignore closed PRs.