L. Blanc
L. Blanc

Reputation: 2310

Filter GitHub PRs by text in PR Summary

I'd like to find all closed PRs containing specific text in the PR Summary (title) field. For example in a project containing PRs that include the programming language in square brackets, I want those that are written in the language "R". An example of such a PR is shown below:

GH-18818: [R] Create a field ref to a field in a struct

So I would like to find all the PRs containing the text "[R]" in the title, but not every PR containing the letter "R", and I only want to search the titles, not the files included in the PRs.

Ideally, I would like to use it in a complex filter including date, like this one that's looking for "[Java]":

[Java] is:pr is:closed merged:2022-09-01..2023-03-19 base:master sort:updated-desc 

However, when I run that filter, I get many unwanted PRs, like this one:

GH-32946: [Go] Implement REE Array and Compare

in the results.

Upvotes: 1

Views: 1421

Answers (2)

Mike Taverne
Mike Taverne

Reputation: 9362

Add this to your filter to remove PRs containing the word R in the title:

NOT [R] in:title

This will not filter out PRs that contain just the letter R.

Note: this will match on "R" not "[R]". The brackets here are part of the filter syntax, not the search term.

Finally, the filter is not case-sensitive, so it will match on the word "R" or "r".

Upvotes: 0

brycestevenwilley
brycestevenwilley

Reputation: 81

There are two parts to answering this; first, You can search for things in the title with the in:title qualifier (https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments).

So

[Java] in:title is:pr is:closed merged:2022-09-01..2023-03-19 base:master sort:updated-desc

should just search in the title.

The second unfortunate part is on this documentation page: https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#use-quotation-marks-for-queries-with-whitespace.

Some non-alphanumeric symbols, such as spaces, are dropped from code search queries within quotation marks, so results can be unexpected.

From playing around with GitHub, it looks like non-alphanumeric symbols are dropped without quotation marks as well. So you won't be able to get the [ ] brackets in your search.

A workaround that might help would be to exclude other languages when searching; this search query will exclude Go PRs from your search

[Java] NOT [Go] in:title is:pr is:closed merged:2022-09-01..2023-03-19 base:master sort:updated-desc

Upvotes: 1

Related Questions