Compare commits

...

7 Commits

Author SHA1 Message Date
itchyny
a21a081629 Fix checking state cache (fix #1136), also switch to octokit methods (#1152) 2025-12-23 16:53:06 -06:00
dependabot[bot]
997185467f build(deps): bump actions/checkout from 4 to 6 (#1306)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-02 21:07:14 -06:00
dependabot[bot]
5611b9defa build(deps): bump actions/publish-action from 0.3.0 to 0.4.0 (#1291)
Bumps [actions/publish-action](https://github.com/actions/publish-action) from 0.3.0 to 0.4.0.
- [Commits](https://github.com/actions/publish-action/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: actions/publish-action
  dependency-version: 0.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-24 16:51:30 -06:00
Chiranjib Swain
fad0de84e5 Improves error handling when rate limiting is disabled on GHES. (#1300)
* rateLimitResult log

* code update for rate limit

* Refactor getRateLimit method to remove mock responses and improve error handling

* retry logic removed

* Simplify warning message for rate limiting not enabled

* Remove redundant comments in rate limiting error handling

* updated the block to use catch (error: unknown) instead of any and added simple type narrowing for status and message.
2025-11-05 09:01:31 -06:00
Bibo-Joshi
39bea7de61 Add Missing Input Reading for only-issue-types (#1298)
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2025-10-31 09:53:07 -05:00
dependabot[bot]
e46bbabb3e build(deps-dev): bump @types/node from 20.10.3 to 24.2.0 and document breaking changes in v10 (#1280)
* build(deps-dev): bump @types/node from 20.10.3 to 24.2.0

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.10.3 to 24.2.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 24.2.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* doc update and check failure fix

* changelog update

* doc update

* doc update

* change log update

* updated doc

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aparna Jyothi <aparnajyothi-y@github.com>
2025-10-21 17:22:46 -05:00
dependabot[bot]
65d1d4804d build(deps-dev): bump eslint-config-prettier from 8.10.0 to 10.1.8 (#1276)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.10.0 to 10.1.8.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.10.0...v10.1.8)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-version: 10.1.8
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-14 14:38:41 -05:00
13 changed files with 109 additions and 38 deletions

View File

@@ -15,7 +15,7 @@ jobs:
dry-run-test: # make sure the action works on a clean machine without building dry-run-test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: ./ - uses: ./
id: stale id: stale
with: with:

View File

@@ -14,7 +14,7 @@ jobs:
steps: steps:
- name: Checking out - name: Checking out
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Publish - name: Publish
id: publish id: publish
uses: actions/publish-immutable-action@v0.0.4 uses: actions/publish-immutable-action@v0.0.4

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update the ${{ env.TAG_NAME }} tag - name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.3.0 uses: actions/publish-action@v0.4.0
with: with:
source-tag: ${{ env.TAG_NAME }} source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@@ -1,6 +1,6 @@
--- ---
name: "@types/node" name: "@types/node"
version: 24.1.0 version: 24.3.1
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,6 +1,6 @@
--- ---
name: undici-types name: undici-types
version: 7.8.0 version: 7.10.0
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

View File

@@ -1,5 +1,35 @@
# 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,6 +3,13 @@
[![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:

29
dist/index.js vendored
View File

@@ -761,6 +761,7 @@ 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 {
@@ -768,7 +769,13 @@ class IssuesProcessor {
return new rate_limit_1.RateLimit(rateLimitResult.data.rate); return new rate_limit_1.RateLimit(rateLimitResult.data.rate);
} }
catch (error) { catch (error) {
logger.error(`Error when getting rateLimit: ${error.message}`); const status = error === null || error === void 0 ? void 0 : error.status;
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}`);
} }
}); });
} }
@@ -1639,9 +1646,13 @@ const getOctokitClient = () => {
const checkIfCacheExists = (cacheKey) => __awaiter(void 0, void 0, void 0, function* () { const checkIfCacheExists = (cacheKey) => __awaiter(void 0, void 0, void 0, function* () {
const client = getOctokitClient(); const client = getOctokitClient();
try { try {
const issueResult = yield client.request(`/repos/${github_1.context.repo.owner}/${github_1.context.repo.repo}/actions/caches`); const cachesResult = yield client.rest.actions.getActionsCacheList({
const caches = issueResult.data['actions_caches'] || []; owner: github_1.context.repo.owner,
return Boolean(caches.find(cache => cache['key'] === cacheKey)); repo: github_1.context.repo.repo,
key: cacheKey // prefix matching
});
const caches = cachesResult.data['actions_caches'] || [];
return caches.some(cache => cache['key'] === cacheKey);
} }
catch (error) { catch (error) {
core.debug(`Error checking if cache exist: ${error.message}`); core.debug(`Error checking if cache exist: ${error.message}`);
@@ -1652,8 +1663,11 @@ const resetCacheWithOctokit = (cacheKey) => __awaiter(void 0, void 0, void 0, fu
const client = getOctokitClient(); const client = getOctokitClient();
core.debug(`remove cache "${cacheKey}"`); core.debug(`remove cache "${cacheKey}"`);
try { try {
// TODO: replace with client.rest. yield client.rest.actions.deleteActionsCacheByKey({
yield client.request(`DELETE /repos/${github_1.context.repo.owner}/${github_1.context.repo.repo}/actions/caches?key=${cacheKey}`); owner: github_1.context.repo.owner,
repo: github_1.context.repo.repo,
key: cacheKey
});
} }
catch (error) { catch (error) {
if (error.status) { if (error.status) {
@@ -2610,7 +2624,8 @@ 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)))) {

28
package-lock.json generated
View File

@@ -20,14 +20,14 @@
"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.1.0", "@types/node": "^24.3.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": "^8.46.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^10.1.8",
"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",
@@ -1854,12 +1854,12 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "24.1.0", "version": "24.3.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.1.tgz",
"integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==", "integrity": "sha512-3vXmQDXy+woz+gnrTvuvNrPzekOi+Ds0ReMxw0LzBiK3a+1k0kQn9f2NWk+lgD4rJehFUmYy2gMhJ2ZI+7YP9g==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~7.8.0" "undici-types": "~7.10.0"
} }
}, },
"node_modules/@types/node-fetch": { "node_modules/@types/node-fetch": {
@@ -3477,13 +3477,17 @@
} }
}, },
"node_modules/eslint-config-prettier": { "node_modules/eslint-config-prettier": {
"version": "8.10.0", "version": "10.1.8",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz",
"integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
"dev": true, "dev": true,
"license": "MIT",
"bin": { "bin": {
"eslint-config-prettier": "bin/cli.js" "eslint-config-prettier": "bin/cli.js"
}, },
"funding": {
"url": "https://opencollective.com/eslint-config-prettier"
},
"peerDependencies": { "peerDependencies": {
"eslint": ">=7.0.0" "eslint": ">=7.0.0"
} }
@@ -7522,9 +7526,9 @@
} }
}, },
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "7.8.0", "version": "7.10.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/universal-user-agent": { "node_modules/universal-user-agent": {

View File

@@ -48,14 +48,14 @@
"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.1.0", "@types/node": "^24.3.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": "^8.46.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^10.1.8",
"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",

View File

@@ -660,11 +660,22 @@ 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) { } catch (error: unknown) {
logger.error(`Error when getting rateLimit: ${error.message}`); const status = (error as {status?: number})?.status;
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

@@ -33,12 +33,14 @@ const getOctokitClient = () => {
const checkIfCacheExists = async (cacheKey: string): Promise<boolean> => { const checkIfCacheExists = async (cacheKey: string): Promise<boolean> => {
const client = getOctokitClient(); const client = getOctokitClient();
try { try {
const issueResult = await client.request( const cachesResult = await client.rest.actions.getActionsCacheList({
`/repos/${context.repo.owner}/${context.repo.repo}/actions/caches` owner: context.repo.owner,
); repo: context.repo.repo,
key: cacheKey // prefix matching
});
const caches: Array<{key?: string}> = const caches: Array<{key?: string}> =
issueResult.data['actions_caches'] || []; cachesResult.data['actions_caches'] || [];
return Boolean(caches.find(cache => cache['key'] === cacheKey)); return caches.some(cache => cache['key'] === cacheKey);
} catch (error) { } catch (error) {
core.debug(`Error checking if cache exist: ${error.message}`); core.debug(`Error checking if cache exist: ${error.message}`);
} }
@@ -48,10 +50,11 @@ const resetCacheWithOctokit = async (cacheKey: string): Promise<void> => {
const client = getOctokitClient(); const client = getOctokitClient();
core.debug(`remove cache "${cacheKey}"`); core.debug(`remove cache "${cacheKey}"`);
try { try {
// TODO: replace with client.rest. await client.rest.actions.deleteActionsCacheByKey({
await client.request( owner: context.repo.owner,
`DELETE /repos/${context.repo.owner}/${context.repo.repo}/actions/caches?key=${cacheKey}` repo: context.repo.repo,
); key: cacheKey
});
} catch (error) { } catch (error) {
if (error.status) { if (error.status) {
core.warning( core.warning(

View File

@@ -124,7 +124,8 @@ 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']) {