Commit Graph

138 Commits

Author SHA1 Message Date
George Joseph 1b80269ed4 Retrieve Issues and PRs using a search filter
_Context:_
Normally, all open issues/PRs in the repository that's running this
action are retrieved then all the label, assignee, milestone, etc. criteria
you provide to the action are applied. Unfortunately, this limits the action
to only those issues and PRs in this repository.  It also prevents operating
on only a subset of issues or PRs that can't be filtered by the existing
action criteria.  A good example of this are PRs that are in a
`review:changes_requested` state.  While additional filtering criteria could
be added to the action, it would result in additional callbacks to GitHub
which could trigger rate-limits to be applied.

_Purpose:_
This option is an array of one or more standard [GitHub Issues and
Pull Requests search queries]
(https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests)
which will be used to retrieve the set of issues/PRs to test and take action
on. These queries will be used in place of the default retrieval of all open
issues and PRs for the context's owner/repo.  It can be used to expand or
limit the set of issues and PRs operated on beyond what is retuned by the
standard query.  When the retrieval is complete, all the other label,
assignee, milestone, etc. criteria will be applied.

You may also use this option to improve performance when you have a large number
of open issues or PRs but only a small subset might be eligible for action. For
instance, let's say you have 1000 open issues in your repository but only those
with label `auto-closable` should ever be automatically marked as stale or
closed.  By default, this action would retrieve all 1000 issues _and all open
PRs_ and iterate over them looking for the label you specified in the
`only-issues-label` parameter. If you use the `only-matching-filter` parameter
with `repo:myorg/myrepo is:issue label:auto-closable` this would limit the
download to just those issues you  _know_ should  have further criteria
applied.

_Syntax:_

```
only-matching-filter: [ "<query_string>", ... ]
```

Or if there's only one query string...

```
only-matching-filter: '<query_string>'
```

_Examples:_
To operate only on the open PRs in your organization that have a review state of
`changes_requested`:

```
only-matching-filter: 'org:myorg is:pr is:open review:changes_requested'
```

Since there's only one query specified, you can omit the array syntax and just
specify the string directly.

GitHub only allows boolean logic and grouping in a Code Searches not in Issues
and Pull Requests searches so there's no way to do an "OR" operation but you
can get around this to a limited degree by specifying multiple search queries
in the form of a string array. Each query is run separately and the results are
accumulated and duplicates removed before any further processing is done.

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:

```
only-matching-filter: '[ "org:myorg is:pr is:open review:changes_requested", "org:myorg is:pr is:open label:submitter-action-required" ]'
```

_Notes:_
* Each query 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 the owner and repository in the context to prevent accidental global
searches.  If the request doesn't already contain an `is:open` search term,
it will automatically be added as well.
* If using the array form, the value of this parameter MUST be valid JSON
which means using double quotes around each query string, not single quotes.

Default value: '[]'

Resolves: #1143
2024-03-20 12:20:00 -06:00
aparnajyothi-y 28ca103628
Upgrade Node to v20 (#1110)
Basic validation / Basic validation (push) Failing after 0s Details
Check dist/ / Check dist/ (push) Failing after 0s Details
Code scanning / CodeQL analysis (push) Failing after 0s Details
e2e tests / dry-run-test (push) Successful in 10s Details
Licensed / Licensed (push) Failing after 0s Details
* Upgrade to v20

* Fix for failed checks

* Fix for failed checks

* 8.0.0

* Packages degraded to older version

* licensed update

* format-check

* Updated the logic

* Format-check

* 9.0.0
2023-12-07 17:48:34 +05:30
Sergey Dolin 8986f6218b Don not try to delete cache if it does not exists 2023-08-22 11:20:20 +02:00
Sergey Dolin dbb041abe2 Fix spelling 2023-07-27 07:16:19 +02:00
Sergey Dolin 19b0faf982 do not restore if caches does not exist 2023-07-21 13:21:36 +02:00
Sergey Dolin 4b8e745923 Add RateLimit 2023-07-11 09:36:52 +02:00
Sergey Dolin a5472823b9 fix dependencies 2023-07-05 17:16:02 +02:00
Sergey Dolin 8f54fa9cb2 remove internal API client 2023-07-05 16:46:04 +02:00
Sergey Dolin ef7b227095 use highlevel actions cache api for restore 2023-07-05 16:42:40 +02:00
Sergey Dolin caeb593a24 use highlevel actions cache api for save 2023-07-05 16:38:08 +02:00
Sergey Dolin d8dfea6c6d use highlevel actions cache api with key-prefix 2023-07-05 10:43:19 +02:00
Sergey Dolin 19f709fe58 use highlevel actions cache api 2023-07-05 10:37:35 +02:00
Sergey Dolin 56c9f4224b Rename createHttpClient to createActionsCacheClient 2023-07-05 09:53:06 +02:00
Sergey Dolin a9c16cbf4d Rename ActionCache to ActionsCache 2023-07-04 18:29:58 +02:00
Sergey Dolin 765f3db869 Add integration tests 2023-07-03 20:25:25 +02:00
Sergey Dolin 57aa6deac4 Add integration tests 2023-07-03 15:07:52 +02:00
Sergey Dolin fa4dca37f7 Add unit tests 2023-07-02 11:01:29 +02:00
Sergey Dolin ab422d01a2 Use cache instead of artifacts 2023-06-30 10:15:37 +02:00
Sergey Dolin c7d43763bf Use cache instead of artifacts 2023-06-23 21:29:53 +02:00
Sergey Dolin 6e0ace4210 Add logging 2023-06-23 09:23:17 +02:00
Sergey Dolin e953c7f258 Add logging 2023-06-23 09:21:22 +02:00
Sergey Dolin 1e059ce975 Do not mutate state in debug mode 2023-06-23 09:12:13 +02:00
Sergey Dolin 650b0fa951 Handle error during rehydration & persistings 2023-06-22 14:36:24 +02:00
Sergey Dolin eae709c29e fix artifact 2023-06-22 14:08:18 +02:00
Sergey Dolin 79fe616082 Add state 2023-06-22 13:54:24 +02:00
Sergey Dolin 51c18470e1 optimize pull request 2023-06-19 22:32:23 +02:00
Milos Pantic 75d4d955ac
Remove labels on stale (#959) 2023-03-21 14:11:19 +01:00
Sergey Dolin 1226ccf00a Resolve conflicts 2023-03-13 19:39:37 +01:00
Sergey Dolin fd837a17e5 Resolve changes requests 2023-03-13 19:39:37 +01:00
Sergey Dolin b5b320bc53 fix licenses 2023-03-13 19:39:37 +01:00
Sergey Dolin 6bc202284c abort the build on the error 2023-03-13 19:35:42 +01:00
Ivan 47a58a6ddf
Configure ESLint and update configuration for Prettier (#949)
* Update ESLint and Prettier configurations

* Rebuild action

* Update package.json
2023-03-09 14:57:55 +02:00
Sergey Dolin dad3c0f9e0 Skip deleting the branch in the upstream of a forkerd repo 2023-01-24 07:40:23 +00:00
John Sudol eed91cbd05
Update how stale handles exempt items (#874) 2022-12-20 15:35:06 -05:00
Iván Reinoso García 65b52aff67
Allow daysBeforeStale options to be float (#841)
* feat: allow daysBeforeStale options to be float

* update dist
2022-10-19 12:08:31 +02:00
Luke Tomlinson 8e8a0e6680
[Bugfix-795] Fix date comparison edge case (#816)
* Fix updatedAt and markedStaleOn date comparison

* Delete accidental file

* Refactor

* Cleanup

* cleanup
2022-09-12 09:38:46 -04:00
JoannaaKL 3e4418e47e
Issue 596/include only assigned (#817)
* Add new 'include-only-assigned' option

If set, only issues containing assignees will be processed

* Test new flag

* Update code comment

* Update src/classes/issues-processor.ts

Co-authored-by: Francesco Renzi <rentziass@github.com>

* Update index.js with typo fix

Co-authored-by: Francesco Renzi <rentziass@github.com>
2022-09-12 13:20:57 +02:00
Luke Tomlinson 2b58cc900f
Fix issue when days-before-close is more than days-before-stale (#775) 2022-07-25 09:24:15 -04:00
Jacob Bandes-Storch 06d2a3904b
Add close-issue-reason option (#764)
* Add close-as-not-planned option

* update readme

* add to Option enum

* improve wording

* npm run pack

* updates from review

* fix tests and improve error message

* fix readme order
2022-06-23 17:43:36 -04:00
0x5c 29e800e1c8
Remove stale when updated without comment (#717)
The existing logic for `remove-stale-when-updated` only considers presence of
comments, ignoring the value of `issueHasUpdate`.

This commits fixes it so it follows the documented behaviour for that setting.

Fixes #715
2022-06-20 15:38:43 -04:00
Adam Stachowicz a78f1809b1
Fix spaces in `issues-processor.ts` (#748)
* Fix spaces in `issues-processor.ts`

* `npm run build` and `npm run pack`
2022-06-20 13:43:08 -04:00
Luke Tomlinson 65d24b7092
Don't process a stale issue in the same run it's marked stale (#696) 2022-04-29 10:07:39 -04:00
Luke Tomlinson a88f7b30b9
Update @actions/github to 5.0.1 (#707)
* Update github package

* Update dist

* Use @actions/github@5.0.1

* Cleanup

* More cleanup
2022-03-31 15:38:16 -04:00
m.bell 7a7efcae1f
Fix per issue operation count (#662)
* Fix per issue operation count

* Run pack
2022-02-04 09:54:35 -05:00
Luke Tomlinson 3a971aeb80 Revert "Merge pull request #586 from C0ZEN/feature/split-pr-and-issue-options"
This reverts commit db699ab3b1, reversing
changes made to b83d488cb9.
2021-10-20 09:25:24 -04:00
TESTELIN Geoffrey b9a40762bf
feat: remove the remove-stale-when-updated option
BREAKING CHANGE:
The option remove-stale-when-updated was removed
2021-10-08 21:30:39 +02:00
TESTELIN Geoffrey bab816b473
feat: remove the days-before-stale option
BREAKING CHANGE:
The option days-before-stale was removed
2021-10-08 21:06:12 +02:00
TESTELIN Geoffrey 6299c36a0d
feat: remove the only-labels option
BREAKING CHANGE:
The option only-labels was removed
2021-10-08 20:39:44 +02:00
TESTELIN Geoffrey a8c5bb1c29
feat: remove the only-labels option
BREAKING CHANGE:
The option only-labels was removed
2021-10-08 20:26:58 +02:00
TESTELIN Geoffrey 1c81c38e2f
feat: remove the any-of-labels option
BREAKING CHANGE:
The option any-of-labels was removed
2021-10-08 20:18:01 +02:00