Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
d7244fd124 build(deps-dev): bump eslint from 8.55.0 to 9.34.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.55.0 to 9.34.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.55.0...v9.34.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.34.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-25 22:54:52 +00:00
18 changed files with 359 additions and 554 deletions

View File

@@ -16,4 +16,4 @@ jobs:
name: Basic validation name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
with: with:
node-version: '24.x' node-version: '20.x'

View File

@@ -16,4 +16,4 @@ jobs:
name: Check dist/ name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with: with:
node-version: '24.x' node-version: '20.x'

View File

@@ -1,6 +1,6 @@
--- ---
name: "@types/node" name: "@types/node"
version: 24.3.1 version: 20.10.3
type: npm type: npm
summary: TypeScript definitions for node summary: TypeScript definitions for node
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node

View File

@@ -1,17 +1,15 @@
--- ---
name: undici-types name: undici-types
version: 7.10.0 version: 5.26.5
type: npm type: npm
summary: A stand-alone types package for Undici summary: A stand-alone types package for Undici
homepage: https://undici.nodejs.org homepage: https://undici.nodejs.org
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: Auto-generated MIT license text
text: | text: |
MIT License MIT License
Copyright (c) Matteo Collina and Undici contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights

View File

@@ -1,35 +1,5 @@
# Changelog # Changelog
# [10.1.0]
## What's Changed
* Add only-issue-types option to filter issues by type by @Bibo-Joshi in https://github.com/actions/stale/pull/1255
# [10.0.0]
## What's Changed
## Breaking Changes
* Upgrade to node 24 by @salmanmkc in https://github.com/actions/stale/pull/1279
Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
## Enhancement
- Introducing sort-by option by @suyashgaonkar in https://github.com/actions/stale/pull/1254
## Dependency Upgrades
* Upgrade actions/publish-immutable-action from 0.0.3 to 0.0.4 by @dependabot[bot] in https://github.com/actions/stale/pull/1186
* Upgrade undici from 5.28.4 to 5.28.5 by @dependabot[bot] in https://github.com/actions/stale/pull/1201
* Upgrade @action/cache from 4.0.0 to 4.0.2 by @aparnajyothi-y in https://github.com/actions/stale/pull/1226
* Upgrade @action/cache from 4.0.2 to 4.0.3 by @suyashgaonkar in https://github.com/actions/stale/pull/1233
* Upgrade undici from 5.28.5 to 5.29.0 by @dependabot[bot] in https://github.com/actions/stale/pull/1251
* Upgrade form-data to bring in fix for critical vulnerability by @gowridurgad in https://github.com/actions/stale/pull/1277
## Documentation changes
- Changelog update for recent releases by @suyashgaonkar in https://github.com/actions/stale/pull/1224
- Permissions update in Readme by @ghadimir in https://github.com/actions/stale/pull/1248
# [9.1.0] # [9.1.0]
## What's Changed ## What's Changed

View File

@@ -3,13 +3,6 @@
[![Basic validation](https://github.com/actions/stale/actions/workflows/basic-validation.yml/badge.svg?branch=main)](https://github.com/actions/stale/actions/workflows/basic-validation.yml) [![Basic validation](https://github.com/actions/stale/actions/workflows/basic-validation.yml/badge.svg?branch=main)](https://github.com/actions/stale/actions/workflows/basic-validation.yml)
[![e2e tests](https://github.com/actions/stale/actions/workflows/e2e-tests.yml/badge.svg?branch=main)](https://github.com/actions/stale/actions/workflows/e2e-tests.yml) [![e2e tests](https://github.com/actions/stale/actions/workflows/e2e-tests.yml/badge.svg?branch=main)](https://github.com/actions/stale/actions/workflows/e2e-tests.yml)
## Breaking changes in V10
- Upgraded action from node20 to node 24
> Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
For more details, see the full release notes on the [release page](https://github.com/actions/stale/releases/tag/v10.0.0)
Warns and then closes issues and PRs that have had no activity for a specified amount of time. Warns and then closes issues and PRs that have had no activity for a specified amount of time.
The configuration must be on the default branch and the default values will: The configuration must be on the default branch and the default values will:
@@ -106,7 +99,6 @@ Every argument is optional.
| [ignore-pr-updates](#ignore-pr-updates) | Override [ignore-updates](#ignore-updates) for PRs only | | | [ignore-pr-updates](#ignore-pr-updates) | Override [ignore-updates](#ignore-updates) for PRs only | |
| [include-only-assigned](#include-only-assigned) | Process only assigned issues | `false` | | [include-only-assigned](#include-only-assigned) | Process only assigned issues | `false` |
| [sort-by](#sort-by) | What to sort issues and PRs by | `created` | | [sort-by](#sort-by) | What to sort issues and PRs by | `created` |
| [only-issue-types](#only-issue-types) | Only issues with a matching type are processed as stale/closed. | |
### List of output options ### List of output options
@@ -563,13 +555,6 @@ Useful to sort the issues and PRs by the specified field. It accepts `created`,
Default value: `created` Default value: `created`
#### only-issue-types
A comma separated list of allowed issue types. Only issues with a matching type will be processed (e.g.: `bug,question`).
If unset (or an empty string), this option will not alter the stale workflow.
Default value: unset
### Usage ### Usage
@@ -587,7 +572,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale' stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale'
stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale' stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale'
@@ -605,7 +590,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
days-before-stale: 30 days-before-stale: 30
@@ -624,7 +609,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
@@ -646,7 +631,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
@@ -670,7 +655,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
stale-issue-message: 'Stale issue message' stale-issue-message: 'Stale issue message'
stale-pr-message: 'Stale pull request message' stale-pr-message: 'Stale pull request message'
@@ -693,7 +678,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
start-date: '2020-04-18T00:00:00Z' # ISO 8601 or RFC 2822 start-date: '2020-04-18T00:00:00Z' # ISO 8601 or RFC 2822
``` ```
@@ -710,7 +695,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
exempt-issue-milestones: 'future,alpha,beta' exempt-issue-milestones: 'future,alpha,beta'
exempt-pr-milestones: 'bugfix,improvement' exempt-pr-milestones: 'bugfix,improvement'
@@ -728,7 +713,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
exempt-all-pr-milestones: true exempt-all-pr-milestones: true
``` ```
@@ -745,7 +730,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
any-of-labels: 'needs-more-info,needs-demo' any-of-labels: 'needs-more-info,needs-demo'
# You can opt for 'only-labels' instead if your use-case requires all labels # You can opt for 'only-labels' instead if your use-case requires all labels
@@ -764,7 +749,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
exempt-issue-assignees: 'marco,polo' exempt-issue-assignees: 'marco,polo'
exempt-pr-assignees: 'marco' exempt-pr-assignees: 'marco'
@@ -782,7 +767,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v10 - uses: actions/stale@v9
with: with:
exempt-all-pr-assignees: true exempt-all-pr-assignees: true
``` ```

View File

@@ -15,8 +15,7 @@ export function generateIssue(
isClosed = false, isClosed = false,
isLocked = false, isLocked = false,
milestone: string | undefined = undefined, milestone: string | undefined = undefined,
assignees: string[] = [], assignees: string[] = []
issue_type?: string
): Issue { ): Issue {
return new Issue(options, { return new Issue(options, {
number: id, number: id,
@@ -40,7 +39,6 @@ export function generateIssue(
login: assignee, login: assignee,
type: 'User' type: 'User'
}; };
}), })
...(issue_type ? {type: {name: issue_type}} : {})
}); });
} }

View File

@@ -1,125 +0,0 @@
import {Issue} from '../src/classes/issue';
import {IIssuesProcessorOptions} from '../src/interfaces/issues-processor-options';
import {IssuesProcessorMock} from './classes/issues-processor-mock';
import {DefaultProcessorOptions} from './constants/default-processor-options';
import {generateIssue} from './functions/generate-issue';
import {alwaysFalseStateMock} from './classes/state-mock';
describe('only-issue-types option', () => {
test('should only process issues with allowed type', async () => {
const opts: IIssuesProcessorOptions = {
...DefaultProcessorOptions,
onlyIssueTypes: 'bug,question'
};
const TestIssueList: Issue[] = [
generateIssue(
opts,
1,
'A bug',
'2020-01-01T17:00:00Z',
'2020-01-01T17:00:00Z',
false,
false,
[],
false,
false,
undefined,
[],
'bug'
),
generateIssue(
opts,
2,
'A feature',
'2020-01-01T17:00:00Z',
'2020-01-01T17:00:00Z',
false,
false,
[],
false,
false,
undefined,
[],
'feature'
),
generateIssue(
opts,
3,
'A question',
'2020-01-01T17:00:00Z',
'2020-01-01T17:00:00Z',
false,
false,
[],
false,
false,
undefined,
[],
'question'
)
];
const processor = new IssuesProcessorMock(
opts,
alwaysFalseStateMock,
async p => (p === 1 ? TestIssueList : []),
async () => [],
async () => new Date().toDateString()
);
await processor.processIssues(1);
expect(processor.staleIssues.map(i => i.title)).toEqual([
'A bug',
'A question'
]);
});
test('should process all issues if onlyIssueTypes is unset', async () => {
const opts: IIssuesProcessorOptions = {
...DefaultProcessorOptions,
onlyIssueTypes: ''
};
const TestIssueList: Issue[] = [
generateIssue(
opts,
1,
'A bug',
'2020-01-01T17:00:00Z',
'2020-01-01T17:00:00Z',
false,
false,
[],
false,
false,
undefined,
[],
'bug'
),
generateIssue(
opts,
2,
'A feature',
'2020-01-01T17:00:00Z',
'2020-01-01T17:00:00Z',
false,
false,
[],
false,
false,
undefined,
[],
'feature'
)
];
const processor = new IssuesProcessorMock(
opts,
alwaysFalseStateMock,
async p => (p === 1 ? TestIssueList : []),
async () => [],
async () => new Date().toDateString()
);
await processor.processIssues(1);
expect(processor.staleIssues.map(i => i.title)).toEqual([
'A bug',
'A feature'
]);
});
});

View File

@@ -208,15 +208,11 @@ inputs:
description: 'Only the issues or the pull requests with an assignee will be marked as stale automatically.' description: 'Only the issues or the pull requests with an assignee will be marked as stale automatically.'
default: 'false' default: 'false'
required: false required: false
only-issue-types:
description: 'Only issues with a matching type are processed as stale/closed. Defaults to `[]` (disabled) and can be a comma-separated list of issue types.'
default: ''
required: false
outputs: outputs:
closed-issues-prs: closed-issues-prs:
description: 'List of all closed issues and pull requests.' description: 'List of all closed issues and pull requests.'
staled-issues-prs: staled-issues-prs:
description: 'List of all staled issues and pull requests.' description: 'List of all staled issues and pull requests.'
runs: runs:
using: 'node24' using: 'node20'
main: 'dist/index.js' main: 'dist/index.js'

32
dist/index.js vendored
View File

@@ -289,13 +289,6 @@ class Issue {
this.assignees = issue.assignees || []; this.assignees = issue.assignees || [];
this.isStale = (0, is_labeled_1.isLabeled)(this, this.staleLabel); this.isStale = (0, is_labeled_1.isLabeled)(this, this.staleLabel);
this.markedStaleThisRun = false; this.markedStaleThisRun = false;
if (typeof issue.type === 'object' &&
issue.type !== null) {
this.issue_type = issue.type.name;
}
else {
this.issue_type = undefined;
}
} }
get isPullRequest() { get isPullRequest() {
return (0, is_pull_request_1.isPullRequest)(this); return (0, is_pull_request_1.isPullRequest)(this);
@@ -513,18 +506,6 @@ class IssuesProcessor {
IssuesProcessor._endIssueProcessing(issue); IssuesProcessor._endIssueProcessing(issue);
return; // If the issue has an 'include-only-assigned' option set, process only issues with nonempty assignees list return; // If the issue has an 'include-only-assigned' option set, process only issues with nonempty assignees list
} }
if (this.options.onlyIssueTypes) {
const allowedTypes = this.options.onlyIssueTypes
.split(',')
.map(t => t.trim().toLowerCase())
.filter(Boolean);
const issueType = (issue.issue_type || '').toLowerCase();
if (!allowedTypes.includes(issueType)) {
issueLogger.info(`Skipping this $$type because its type ('${issue.issue_type}') is not in onlyIssueTypes (${allowedTypes.join(', ')})`);
IssuesProcessor._endIssueProcessing(issue);
return;
}
}
const onlyLabels = (0, words_to_list_1.wordsToList)(this._getOnlyLabels(issue)); const onlyLabels = (0, words_to_list_1.wordsToList)(this._getOnlyLabels(issue));
if (onlyLabels.length > 0) { if (onlyLabels.length > 0) {
issueLogger.info(`The option ${issueLogger.createOptionLink(option_1.Option.OnlyLabels)} was specified to only process issues and pull requests with all those labels (${logger_service_1.LoggerService.cyan(onlyLabels.length)})`); issueLogger.info(`The option ${issueLogger.createOptionLink(option_1.Option.OnlyLabels)} was specified to only process issues and pull requests with all those labels (${logger_service_1.LoggerService.cyan(onlyLabels.length)})`);
@@ -761,7 +742,6 @@ class IssuesProcessor {
}); });
} }
getRateLimit() { getRateLimit() {
var _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const logger = new logger_1.Logger(); const logger = new logger_1.Logger();
try { try {
@@ -769,13 +749,7 @@ class IssuesProcessor {
return new rate_limit_1.RateLimit(rateLimitResult.data.rate); return new rate_limit_1.RateLimit(rateLimitResult.data.rate);
} }
catch (error) { catch (error) {
const status = error === null || error === void 0 ? void 0 : error.status; logger.error(`Error when getting rateLimit: ${error.message}`);
const message = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : String(error);
if (status === 404 && message.includes('Rate limiting is not enabled')) {
logger.warning('Rate limiting is not enabled on this instance. Proceeding without rate limit checks.');
return undefined;
}
logger.error(`Error when getting rateLimit: ${message}`);
} }
}); });
} }
@@ -2251,7 +2225,6 @@ var Option;
Option["IgnorePrUpdates"] = "ignore-pr-updates"; Option["IgnorePrUpdates"] = "ignore-pr-updates";
Option["ExemptDraftPr"] = "exempt-draft-pr"; Option["ExemptDraftPr"] = "exempt-draft-pr";
Option["CloseIssueReason"] = "close-issue-reason"; Option["CloseIssueReason"] = "close-issue-reason";
Option["OnlyIssueTypes"] = "only-issue-types";
})(Option || (exports.Option = Option = {})); })(Option || (exports.Option = Option = {}));
@@ -2617,8 +2590,7 @@ function _getAndValidateArgs() {
ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'), ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'),
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true', exemptDraftPr: core.getInput('exempt-draft-pr') === 'true',
closeIssueReason: core.getInput('close-issue-reason'), closeIssueReason: core.getInput('close-issue-reason'),
includeOnlyAssigned: core.getInput('include-only-assigned') === 'true', includeOnlyAssigned: core.getInput('include-only-assigned') === 'true'
onlyIssueTypes: core.getInput('only-issue-types')
}; };
for (const numberInput of ['days-before-stale']) { for (const numberInput of ['days-before-stale']) {
if (isNaN(parseFloat(core.getInput(numberInput)))) { if (isNaN(parseFloat(core.getInput(numberInput)))) {

599
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "stale-action", "name": "stale-action",
"version": "10.0.0", "version": "9.0.0",
"private": true, "private": true,
"description": "Marks old issues and PRs as stale", "description": "Marks old issues and PRs as stale",
"main": "lib/main.js", "main": "lib/main.js",
@@ -31,8 +31,8 @@
"stale" "stale"
], ],
"engines": { "engines": {
"node": "24", "node": "20",
"npm": ">=7.0.0" "npm": ">=7.0.0 <10.0.0-0"
}, },
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
@@ -48,20 +48,20 @@
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/lodash.deburr": "^4.1.6", "@types/lodash.deburr": "^4.1.6",
"@types/node": "^24.3.1", "@types/node": "^20.5.1",
"@types/semver": "^7.5.0", "@types/semver": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^6.2.1", "@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1", "@typescript-eslint/parser": "^6.2.1",
"@vercel/ncc": "^0.36.1", "@vercel/ncc": "^0.36.1",
"ansi-styles": "5.2.0", "ansi-styles": "5.2.0",
"eslint": "^8.46.0", "eslint": "^9.34.0",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^8.8.0",
"eslint-plugin-jest": "^27.2.3", "eslint-plugin-jest": "^27.2.3",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"jest": "^29.6.2", "jest": "^29.6.2",
"jest-circus": "^29.5.0", "jest-circus": "^29.5.0",
"jest-silent-reporter": "^0.5.0", "jest-silent-reporter": "^0.5.0",
"js-yaml": "^4.1.1", "js-yaml": "^4.1.0",
"prettier": "^2.8.7", "prettier": "^2.8.7",
"standard-version": "^9.3.1", "standard-version": "^9.3.1",
"terminal-link": "^2.1.1", "terminal-link": "^2.1.1",

View File

@@ -24,7 +24,6 @@ export class Issue implements IIssue {
markedStaleThisRun: boolean; markedStaleThisRun: boolean;
operations = new Operations(); operations = new Operations();
private readonly _options: IIssuesProcessorOptions; private readonly _options: IIssuesProcessorOptions;
readonly issue_type?: string;
constructor( constructor(
options: Readonly<IIssuesProcessorOptions>, options: Readonly<IIssuesProcessorOptions>,
@@ -44,15 +43,6 @@ export class Issue implements IIssue {
this.assignees = issue.assignees || []; this.assignees = issue.assignees || [];
this.isStale = isLabeled(this, this.staleLabel); this.isStale = isLabeled(this, this.staleLabel);
this.markedStaleThisRun = false; this.markedStaleThisRun = false;
if (
typeof (issue as any).type === 'object' &&
(issue as any).type !== null
) {
this.issue_type = (issue as any).type.name;
} else {
this.issue_type = undefined;
}
} }
get isPullRequest(): boolean { get isPullRequest(): boolean {

View File

@@ -252,23 +252,6 @@ export class IssuesProcessor {
return; // If the issue has an 'include-only-assigned' option set, process only issues with nonempty assignees list return; // If the issue has an 'include-only-assigned' option set, process only issues with nonempty assignees list
} }
if (this.options.onlyIssueTypes) {
const allowedTypes = this.options.onlyIssueTypes
.split(',')
.map(t => t.trim().toLowerCase())
.filter(Boolean);
const issueType = (issue.issue_type || '').toLowerCase();
if (!allowedTypes.includes(issueType)) {
issueLogger.info(
`Skipping this $$type because its type ('${
issue.issue_type
}') is not in onlyIssueTypes (${allowedTypes.join(', ')})`
);
IssuesProcessor._endIssueProcessing(issue);
return;
}
}
const onlyLabels: string[] = wordsToList(this._getOnlyLabels(issue)); const onlyLabels: string[] = wordsToList(this._getOnlyLabels(issue));
if (onlyLabels.length > 0) { if (onlyLabels.length > 0) {
@@ -660,22 +643,11 @@ export class IssuesProcessor {
async getRateLimit(): Promise<IRateLimit | undefined> { async getRateLimit(): Promise<IRateLimit | undefined> {
const logger: Logger = new Logger(); const logger: Logger = new Logger();
try { try {
const rateLimitResult = await this.client.rest.rateLimit.get(); const rateLimitResult = await this.client.rest.rateLimit.get();
return new RateLimit(rateLimitResult.data.rate); return new RateLimit(rateLimitResult.data.rate);
} catch (error: unknown) { } catch (error) {
const status = (error as {status?: number})?.status; logger.error(`Error when getting rateLimit: ${error.message}`);
const message = (error as {message?: string})?.message ?? String(error);
if (status === 404 && message.includes('Rate limiting is not enabled')) {
logger.warning(
'Rate limiting is not enabled on this instance. Proceeding without rate limit checks.'
);
return undefined;
}
logger.error(`Error when getting rateLimit: ${message}`);
} }
} }

View File

@@ -49,6 +49,5 @@ export enum Option {
IgnoreIssueUpdates = 'ignore-issue-updates', IgnoreIssueUpdates = 'ignore-issue-updates',
IgnorePrUpdates = 'ignore-pr-updates', IgnorePrUpdates = 'ignore-pr-updates',
ExemptDraftPr = 'exempt-draft-pr', ExemptDraftPr = 'exempt-draft-pr',
CloseIssueReason = 'close-issue-reason', CloseIssueReason = 'close-issue-reason'
OnlyIssueTypes = 'only-issue-types'
} }

View File

@@ -15,7 +15,6 @@ export interface IIssue {
locked: boolean; locked: boolean;
milestone?: IMilestone | null; milestone?: IMilestone | null;
assignees?: Assignee[] | null; assignees?: Assignee[] | null;
issue_type?: string;
} }
export type OctokitIssue = components['schemas']['issue']; export type OctokitIssue = components['schemas']['issue'];

View File

@@ -55,5 +55,4 @@ export interface IIssuesProcessorOptions {
exemptDraftPr: boolean; exemptDraftPr: boolean;
closeIssueReason: string; closeIssueReason: string;
includeOnlyAssigned: boolean; includeOnlyAssigned: boolean;
onlyIssueTypes?: string;
} }

View File

@@ -124,8 +124,7 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'), ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'),
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true', exemptDraftPr: core.getInput('exempt-draft-pr') === 'true',
closeIssueReason: core.getInput('close-issue-reason'), closeIssueReason: core.getInput('close-issue-reason'),
includeOnlyAssigned: core.getInput('include-only-assigned') === 'true', includeOnlyAssigned: core.getInput('include-only-assigned') === 'true'
onlyIssueTypes: core.getInput('only-issue-types')
}; };
for (const numberInput of ['days-before-stale']) { for (const numberInput of ['days-before-stale']) {