sindresorhus/refined-github

Filter by "Draft PRs only" in PR list #1900

FloEdelmann posted onGitHub

In a repo's PR list, it would sometimes be useful to see only draft pull requests (e.g. to close long stale drafts or look which can be made "ready to review"). This can be done by adding is:draft to the search term (see GitHub help article; unfortunately is:pr is:open -is:draft doesn't work as expected :confused:).

I see two possibilities where this could be added:

  1. On the left "Open/Close" switcher: Add a "Draft" state. Problems:
    • Takes up much space, which could reintroduce #1830.
    • A draft PR is also "open".
    • The number of open PRs would likely need to be fetched via the API.
  2. In the "Reviews" filter menu: Add a "Not ready for review (Draft PR)" item. Problem:
    • Not very discoverable.

In the "Reviews" filter menu: Add a "Not ready for review (Draft PR)" item.

I think this is good enough

posted by bfred-it over 5 years ago

Should it be a new feature (like filter-draft-prs) or part of filter-pr-by-build-status? It's the only feature that adding it to might be considered. Maybe then rename the feature to simply filter-prs?

posted by FloEdelmann over 5 years ago

Yeah it might make sense to make a pr-filters feature

posted by bfred-it over 5 years ago

unfortunately is:pr is:open -is:draft doesn't work as expected 😕

Oddly enough, it works as expected on the global GitHub search... 🤔 query: repo:sindresorhus/refined-github is:pr is:open -is:draft (currently there is one draft PR open)

posted by sharkykh over 5 years ago

I've researched a bit more:

Combining is:draft/-is:draft with is:open / is:closed is not respected at all in PR lists:

Using the exact same queries with repo:... in the global search yields the expected results:

I've contacted GitHub about this issue. Until it is fixed, adding a filter menu item that doesn't work as expected does not make sense in my opinion.

posted by FloEdelmann over 5 years ago

Thanks for researching, but I don't think that affects this feature much. The filter is called "Not ready for review (Draft PR)" and those repo searches show exactly that: Draft PRs. The only issue is that also closed draft PRs will be shown, but that a minor problem IMHO

posted by bfred-it over 5 years ago

@FloEdelmann any reference to an issue with them that one could follow?

posted by vlfig over 5 years ago

@vlfig No, I contacted the GitHub team via the contact form and just got an automated response with a ticket ID but no link or similar.

posted by FloEdelmann over 5 years ago

@FloEdelmann Oops, I just tried is:pr is:open draft:false and it works.

posted by vlfig over 5 years ago

@vlfig Weird :smile:

draft:true/draft:false actually works as expected in both the PR list and the global search. I can't find any documentation about it though.

posted by FloEdelmann over 5 years ago

We started using this on our team recently and came searching for this! 👍

FWIW I tried, in order:

  • Looked at Status dropdown because to me "Draft" is a status of a PR
  • Looked at Sort to see if I could at least sort drafts first
  • Looking at any other kind of dropdown label that might indicate draftness

I never looked at Reviews because I did not mentally connect Drafts with Reviews.

posted by kamranayub over 5 years ago

I never looked at Reviews because I did not mentally connect Drafts with Reviews.

But that's what they are. When you're done drafting a PR, you literally click the "Ready for review" button. 😅

posted by fregante over 5 years ago

Intellectually I know that, I'm just relating how I acted as a user looking for a word related to Drafts. 🙏

On Wed, Sep 25, 2019, 1:30 PM Federico Brigante notifications@github.com wrote:

I never looked at Reviews because I did not mentally connect Drafts with Reviews.

But that's what they are. When you're done drafting a PR, you literally click the "Ready for review" button. 😅

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sindresorhus/refined-github/issues/1900?email_source=notifications&email_token=AAEJU22R7RPAHNHPXR3EADTQLOU5PA5CNFSM4HCVJ5G2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7S4RSY#issuecomment-535152843, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEJU26VPXMKWXG3HEF57R3QLOU5PANCNFSM4HCVJ5GQ .

posted by kamranayub over 5 years ago

I didn't see this mentioned, sorry if I missed it: I'd like to have a similar filter to hide Draft PRs.

This would be especially useful around sprint time when there's a bunch of drafts and a bunch of finished ones, and it's quite hard to tell apart. It's useful to know about draft:false but I have a zillion things to remember already and would appreciate a drop down option!

posted by bbugh over 5 years ago

I just stumbled across this section in the GitHub docs, so it seems like we implemented the correct filters :sweat_smile:

posted by FloEdelmann almost 5 years ago

Just wanted to check since I am not certain this is working with GHE domains. For example, I see its enabled in the console:

image

But notice the filters are unchanged:

image

Is anyone else seeing this too?

posted by kamranayub almost 5 years ago

In general, when looking through Pull Requests you would ignore pull requests that are marked as drafts (unless maybe they are your own) since they are not ready for review. Therefore, I wonder if it makes sense to hide them by default.

posted by simonkotwicz about 4 years ago

@kamranayub On regular github.com, it works fine. I can't tell whether it works on GHE. @busches could you have a look please?

@simonkotwicz I don't think it makes sense to hide draft PRs by default. Sometimes you might want to check on them to make sure they keep being updated (or ping the author). If they're not shown by default, they might be easily missed.

posted by FloEdelmann about 4 years ago

@FloEdelmann the draft:true and draft:false filters work fine on GHE 2.21 and I see them in the dropdown image

@kamranayub please let us know what version of GHE you're on and if there are any other errors. Otherwise we may need the DOM to help recreate.

posted by busches about 4 years ago

Don't see the "Filter by draft PRs" filters group in popup on github.com Good to know about draft:false 🤷

posted by alex-polunochev about 4 years ago

Fund this Issue

$0.00
Funded

Pull requests