-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
bugSomething isn't workingSomething isn't workingp2Affects more than a few users but doesn't prevent core functionsAffects more than a few users but doesn't prevent core functions
Description
Describe the bug
gh pr list --labelappears to be using OR logic instead of AND logicgh pr list --labelsometimes contains duplicates.
To show why this is a problem, imagine your PRs have the following labels:
in progress,ready for review, andreviewedteam a,team b, andteam c.
Now let's say you want to find all of the PRs that are ready for review from team b.
So it makes sense that you try to search for --label "ready for review,team b". However, instead of getting a list of every PR that is both "ready for review" and "team b," you get:
- Every PR labeled "ready for review," even if it is not from "team b."
- Every PR labeled "team b," even if it is not "ready for review."
These results are useless from the perspective of someone who wants to review PRs from team b that are ready for review.
$ gh --version
gh version 0.5.4 (2020-02-04)
https://github.com/cli/cli/releases/tag/v0.5.4
Steps to reproduce the behavior
- Create a PR named "Example A" with labels
test-aandtest-c - Create a PR named "Example B" with labels
test-bandtest-c - Run
gh pr list -l test-a,test-c
Expected vs actual behavior
Expected:
Pull requests for ...
#17874 Example A example-a
Actual:
Pull requests for ...
#17875 Example B example-b
#17874 Example A example-a
#17874 Example A example-a
Broken expectations:
- I expected "Example B" to not appear at all, because it does not have the
test-alabel and therefore doesn't satisfy the given query. - I expected "Example A" to appear only once, because there is no point in having duplicates in this list.
Possible solutions
At minimum, use AND by default.
Ideally, support full boolean logic:
gh pr list -l "team a AND (ready for review OR NOT in progress)"Logs
$ gh pr list -l test-a
Pull requests for ...
#17874 Example A example-a
$ gh pr list -l test-b
Pull requests for ...
#17875 Example B example-b
$ gh pr list -l test-c
Pull requests for ...
#17875 Example B example-b
#17874 Example A example-a
$ gh pr list -l test-a,test-c
Pull requests for ...
#17875 Example B example-b
#17874 Example A example-a
#17874 Example A example-a
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingp2Affects more than a few users but doesn't prevent core functionsAffects more than a few users but doesn't prevent core functions