Skip to content

gh pr view cannot find open pull requests #888

Closed

Description

@maxandersen

Describe the bug

I'm in a checkout of https://github.com/maxandersen/quarkusio.github.io/tree/insights1
and https://github.com/quarkusio/quarkusio.github.io/pull/535 are open but gh pr view reports
no open pull requests found for branch "insights1"

My best guess is that somehow it does not like the base branch is develop and not master but that is just a guess.

Steps to reproduce the behavior

see above

Expected vs actual behavior

gh pr view should show the open pull request no matter what branch it is against.

Activity

  1. mislav commented on May 8, 2020

    @mislav
    Contributor

    Thank you for reporting! I cannot reproduce right now because your PR got merged in the meantime and is no longer open.

    Additionally, I have checked out a fork PR in a different repository that has the base branch set to develop and gh pr view worked there, so no luck reproducing either.

    The next time you can reproduce with an open source repository, can you give us a heads up and also include your git remote -v configuration and more information about the current branch (git config --get-regexp branch.`git branch --show-current`.*)?

  2. maxandersen commented on May 8, 2020

    @maxandersen
    Author

    okey, here is a new PR with same issue: quarkusio/quarkusio.github.io#541

    git remote -v
    maxandersen      https://github.com/maxandersen/quarkusio.github.io.git (fetch)
    maxandersen     https://github.com/maxandersen/quarkusio.github.io.git (push)
    origin  https://github.com/quarkusio/quarkusio.github.io (fetch)
    origin  https://github.com/quarkusio/quarkusio.github.io (push)
    xorye   https://github.com/xorye/quarkusio.github.io.git (fetch)
    xorye   https://github.com/xorye/quarkusio.github.io.git (push)
    

    git config --get-regexp branch.`git branch --show-current`.*

    returns nothing.

  3. mislav commented on May 8, 2020

    @mislav
    Contributor

    git config --get-regexp branch.`git branch --show-current`.*

    returns nothing.

    Ah, thank you for this. The missing upstream configuration for a branch reminded me that we do have an issue for this open, although around gh pr status. These commands use the same mechanism for detecting the current branch.

    Duplicate of #575

    In the meantime, you can work around this by always publishing your branch to your fork like this:

    # note the `-u` (`--set-upstream`) flag
    git push -u maxandersen HEAD
  4. NathanielRN commented on Dec 17, 2021

    @NathanielRN

    This is curious because if I do gh pr ready, or status on aws-observability/aws-otel-python#48 it finds the PR just fine. But if I do gh pr view it doesn't work until I do the git push -u fork fix you mention @mislav .

    Would your team consider changing the gh pr view behvaior to be similar to the ready or status command when searching for the PR so that we don't need a tracking upstream for our branches? 🙂

  5. mislav commented on Dec 20, 2021

    @mislav
    Contributor

    @NathanielRN Yes, that's exactly what we're tracking in the referenced issue. The remote branch should be detected regardless of tracking information or not. Additionally, you're right that different commands have different branch detection logic. We will try to consolidate that into unified detection.

  6. maxandersen commented on Mar 8, 2023

    @maxandersen
    Author

    In the meantime, you can work around this by always publishing your branch to your fork like this:

    some years later - gh pr view still fails to find pr for my branch even when using -u to mark upstream.

    Any way to improve/get it working?

  7. mislav commented on Mar 8, 2023

    @mislav
    Contributor

    @maxandersen Sorry for the nuisance. You can try rerunning the command with GH_DEBUG=api to see underlying API requests, including which branch is gh trying to query for.

    Additional, you could share with us the output of:

    git config --get-regexp "^branch.$(git branch --show-current).(remote|merge)\$"
  8. maxandersen commented on Mar 8, 2023

    @maxandersen
    Author

    output is:

    git config --get-regexp "^branch.$(git branch --show-current).(remote|merge)\$"
    branch.alpha5.remote maxandersen
    branch.alpha5.merge refs/heads/alpha5
    

    and GH_DEBUG API shows it queries maxandersen remote but my remote setup is:

     git remote -v
    maxandersen	https://github.com/maxandersen/quarkusio.github.io (fetch)
    maxandersen	https://github.com/maxandersen/quarkusio.github.io (push)
    origin	https://github.com/quarkusio/quarkusio.github.io.git (fetch)
    origin	https://github.com/quarkusio/quarkusio.github.io.git (push)
    

    and origin is where I would expect it to look for the pull-requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmore-info-neededMore info needed from user/contributor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions