Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh pr view can't find PR just created #2311

Closed
GMNGeoffrey opened this issue Oct 28, 2020 · 6 comments
Closed

gh pr view can't find PR just created #2311

GMNGeoffrey opened this issue Oct 28, 2020 · 6 comments
Labels
bug Something isn't working needs-user-input

Comments

@GMNGeoffrey
Copy link

Describe the bug

After creating a PR, gh can't find the PR when I run gh pr view. Potentially relevant, the PR is not against the default branch.

$ gh pr create --base="${BASE_BRANCH?}" --head="${GITHUB_USERNAME?}:${PR_BRANCH?}" --title="${TITLE?}" --body="${BODY?}"

Creating pull request for GMNGeoffrey:llvm-dependent-submodule-update into google in google/iree

https://github.com/google/iree/pull/3641

gcmn@ws 2020-10-28 10:13 ~/git/iree$ gh pr view
no open pull requests found for branch "llvm-dependent-submodule-update"

gcmn@ws 2020-10-28 10:13 ~/git/iree$ gh --version
gh version 1.2.0 (2020-10-27)
https://github.com/cli/cli/releases/latest

I tried downgrading to each version going back to 0.12.0 and still hit the error, so I think this isn't a pure code release issue. Maybe it's some data that is stored by the tool and would be picked up by other versions?

Steps to reproduce the behavior

I'm not sure exactly the right way to tickle this since it doesn't seem to happen every time, but essentially:

  1. gh pr create --fill --base not-the-default
  2. gh pr view
  3. Doesn't find the PR

Expected vs actual behavior

gh pr view should find the existing PR for the branch.

@GMNGeoffrey GMNGeoffrey added the bug Something isn't working label Oct 28, 2020
@mislav
Copy link
Contributor

mislav commented Oct 29, 2020

Thank you for reporting! It looks like gh failed to detect that llvm-dependent-submodule-update was pushed to a remote that points to your fork.

What is the upstream configuration for this branch? See git config -l | grep llvm-dependent-submodule-update

@GMNGeoffrey
Copy link
Author

It doesn't show up at all in git config -l (the output to that command is empty)

@GMNGeoffrey
Copy link
Author

This issue persists. Any pointers?

@vilmibm
Copy link
Contributor

vilmibm commented Dec 16, 2020

gh pr view relies on mapping the current locally checked out branch to a remote tracking branch so that the github host can be queried appropriately for PR data; in your example it seems like you're creating PRs without any configured tracking information, making it impossible for gh to open the PR.

Is it acceptable to you to manually specify the PR number as an argument for gh pr view? If not the only thing I can think of is to add the required tracking/remote configuration when creating a PR, but that feels like too much assuming of user intent.

@GMNGeoffrey
Copy link
Author

git seems to be able to push to the branch fine, so something is definitely telling it what to track. Perhaps because I have push.default = current?

$ git config --get push.default
current

The whole reason I'm running gh pr view is to get the PR number of the PR, so specifying the PR number wouldn't really help here :-P

@mislav
Copy link
Contributor

mislav commented Dec 16, 2020

@GMNGeoffrey Thank you for all the info. I understand now that this is a duplicate of #575. Sorry for the nuisance!

@mislav mislav closed this as completed Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-user-input
Projects
None yet
Development

No branches or pull requests

3 participants