You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently all open issues for context.repo.owner and
context.repo.repo are retrieved using a simple call to
client.rest.issues.listForRepo(); If we wanted to add other
critera to determine staleness, like only considering PRs with
a review state of "changes_requested", we'd have to make additional
rest calls to get the reviews for each PR. This is fine but it only
solves the issue for review state. Instead, this PR introduces a
new action parameter named `only-matching-filter` which takes one
or more standard GitHub Issue and Pull Request search strings.
So instead of retrieving all open issues and PRs, you can limit the
set to operate on by any criteria that GitHub supports. In the
process, it opens up the ability to expand the set to include
an entire organization or owner instead of just one repo.
Example: Retrieve all open PRs for organization "myorg" that are
in review state "changes_requested":
`only-matching-filter: 'org:myorg is:pr is:open review:changes_requested'`
Once that set is retrieved, all the other label, milestone,
assignee, date, etc. filters are applied as usual.
Although GitHub only allows boolean search critera in a Code search,
you an get around that somewhat by specifying multiple search strings
separated by ` || `.
Example: Retrieve all open PRs for organization "myorg" that are
in review state "changes_requested" or that have the label
`submitter-action-required` assigned:
(split onto two lines for clarity)
```
only-matching-filter: 'org:myorg is:pr is:open review:changes_requested ||
org:myorg is:pr is:open label:submitter-action-required'
```
Again, once that set is retrieved and duplicates filtered out, all
the other label, milestone, assignee, date, etc. filters are applied
as usual.
If there aren't any `owner`, `org`, `user` or `repo` search terms in
the filters, the search is automatically scoped to the context owner
and repo. This prevents accidental global searches. `is:open` is
also added if not already present.
Resolves: #1143
Copy file name to clipboardexpand all lines: README.md
+19
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,7 @@ Every argument is optional.
60
60
| [close-issue-reason](#close-issue-reason) | Reason to use when closing issues | `not_planned` |
61
61
| [stale-pr-label](#stale-pr-label) | Label to apply on staled PRs | `Stale` |
62
62
| [close-pr-label](#close-pr-label) | Label to apply on closed PRs | |
63
+
| [only-matching-filter](#only-matching-filter) | Only issues/PRs matching the search filter(s) will be retrieved and tested | |
63
64
| [exempt-issue-labels](#exempt-issue-labels) | Labels on issues exempted from stale | |
64
65
| [exempt-pr-labels](#exempt-pr-labels) | Labels on PRs exempted from stale | |
65
66
| [only-labels](#only-labels) | Only issues/PRs with ALL these labels are checked | |
@@ -258,6 +259,24 @@ It will be automatically removed if the pull requests are no longer closed nor l
258
259
Default value: unset
259
260
Required Permission: `pull-requests: write`
260
261
262
+
#### only-matching-filter
263
+
264
+
One or more standard [GitHub Issues and Pull Requests search filters](https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests)
265
+
which will be used to retrieve the set of issues/PRs to test and take action on. Normally, all open issues/PRs in the context's owner/repo are retrieved.
266
+
267
+
GitHub only allows boolean logic and grouping in a Code Search not in Issues and Pull Requests search so there's no way to do an "OR" operation but you can get around this to
268
+
a limited degree by specifying multiple search requests separated by ` || `. Each request is run separately and the results are accumulated and duplicates
269
+
removed before any further processing is done.
270
+
271
+
Each request is checked to ensure it contains an `owner:`, `org:`, `user:` or `repo:` search term. If it doesn't, the search will automatically be scoped to
272
+
the owner and repository in the context. This prevents accidental global searches. If the request doesn't already contain an `is:open` search term, it will automatically be added as well.
273
+
274
+
Example: To retrieve all of the open PRs in your organization that have a review state of `changes_requested` or a label named `submitter-action-required`, you'd use:
0 commit comments