Merge 3028f847b0945c7102c84bc13db0329cb8fcaace into 3f3b0175e8c66fb49b9a6d5a0cd1f8436d4c3ab6

This commit is contained in:
Slava Egorov 2023-12-15 11:49:00 +00:00 committed by GitHub
commit 2e7ed8f509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 0 deletions

21
dist/index.js vendored
View File

@ -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:
// 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()) &&
this.options.stalePrLabel === this.options.staleIssueLabel &&
!labels.includes(this.options.staleIssueLabel)) {
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

View File

@ -563,12 +563,39 @@ export class IssuesProcessor {
// grab issues from github in batches of 100
async getIssues(page: number): Promise<Issue[]> {
// 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:
// because we only want to process stale issues.
if (
!shouldMarkWhenStale(this._getDaysBeforeIssueStale()) &&
!shouldMarkWhenStale(this._getDaysBeforePrStale()) &&
this.options.stalePrLabel === this.options.staleIssueLabel &&
!labels.includes(this.options.staleIssueLabel)
) {
labels += (labels !== '' ? ',' : '') + this.options.staleIssueLabel;
}
try {
this.operations.consumeOperation();
const issueResult = await this.client.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels,
per_page: 100,
direction: this.options.ascending ? 'asc' : 'desc',
page