-
Notifications
You must be signed in to change notification settings - Fork 407
Filter issues by labels when listing if possible #1084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -676,12 +676,33 @@ class IssuesProcessor { | |
| getIssues(page) { | ||
| var _a; | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| // Compute labels filter. | ||
| let labels = ''; | ||
| // We can filter issues already when listing them if neither only-pr-labels | ||
| // nor only-issue-labels are specified or both are the same. | ||
| if (this.options.onlyPrLabels === '' && | ||
| this.options.onlyIssueLabels === '') { | ||
| labels = this.options.onlyLabels; | ||
| } | ||
| else if (this.options.onlyPrLabels == this.options.onlyIssueLabels) { | ||
| labels = this.options.onlyIssueLabels; | ||
| } | ||
| // If we don't have to mark issues and pull requests stale and | ||
| // both the stale labels are the same then we can use it as a filter: | ||
mraleph marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // because we only want to process stale issues. | ||
| if (!(0, should_mark_when_stale_1.shouldMarkWhenStale)(this._getDaysBeforeIssueStale()) && | ||
| !(0, should_mark_when_stale_1.shouldMarkWhenStale)(this._getDaysBeforePrStale()) && | ||
mraleph marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| this.options.stalePrLabel === this.options.staleIssueLabel && | ||
| !labels.includes(this.options.staleIssueLabel)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The !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)) |
||
| labels += (labels !== '' ? ',' : '') + this.options.staleIssueLabel; | ||
| } | ||
| try { | ||
| this.operations.consumeOperation(); | ||
| const issueResult = yield this.client.rest.issues.listForRepo({ | ||
| owner: github_1.context.repo.owner, | ||
| repo: github_1.context.repo.repo, | ||
| state: 'open', | ||
| labels, | ||
| per_page: 100, | ||
| direction: this.options.ascending ? 'asc' : 'desc', | ||
| page | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.