Filter issues by labels when listing if possible#1084
Open
mraleph wants to merge 1 commit intoactions:mainfrom
Open
Filter issues by labels when listing if possible#1084mraleph wants to merge 1 commit intoactions:mainfrom
mraleph wants to merge 1 commit intoactions:mainfrom
Conversation
* If `only-issue-labels` and `only-pr-labels` are not specified we limit the listing to `only-labels`. * If `only-issue-labels` and `only-pr-labels` are specified but are the same, we limit the listing to these labels. * If we don't need to make neither issues nor PRs as stale (`days-before-issue-stale` and `days-before-pr-stale` are negative) and stale label is the same for issues and PRs then we filter by this label.
lrhn
reviewed
Aug 31, 2023
lrhn
left a comment
There was a problem hiding this comment.
(Drive-by-comments. Sorry, not sorry 😉)
| if (!(0, should_mark_when_stale_1.shouldMarkWhenStale)(this._getDaysBeforeIssueStale()) && | ||
| !(0, should_mark_when_stale_1.shouldMarkWhenStale)(this._getDaysBeforePrStale()) && | ||
| this.options.stalePrLabel === this.options.staleIssueLabel && | ||
| !labels.includes(this.options.staleIssueLabel)) { |
There was a problem hiding this comment.
The includes doesn't require the text to be an entire label. If we have labels stale and maybe-stale, then the includes('stale') will match a maybe-stale label.
Consider over-engineering this as:
!new RegExp('(?:^|,)' + this.options.staleIssueLabel + '(?:,|$)').test(labels)If there can be surrounding whitespace around the label, then:
!new RegExp('(?:^|,)\\s*' + this.options.staleIssueLabel + '\\s*(?:,|$)').test(labels)(Or the, maybe, more memory-intensive, but less RegExp-y:
![...labels.split(',').map(s=>s.trim())].includes(this.options.staleIssueLable))
miaadkhodro-wq
approved these changes
Oct 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
only-issue-labelsandonly-pr-labelsare not specifiedwe limit the listing to
only-labels.only-issue-labelsandonly-pr-labelsare specifiedbut are the same, we limit the listing to these labels.
(
days-before-issue-staleanddays-before-pr-stalearenegative) and stale label is the same for issues and PRs
then we filter by this label.
This allows to significantly limit amount of processing done by this action on repos with large number of open issues.
Related issue:
#1046
Check list: