Compare commits

..

3 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
7 changed files with 32 additions and 32 deletions

View File

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

View File

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

View File

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

17
dist/index.js vendored
View File

@@ -1646,9 +1646,13 @@ const getOctokitClient = () => {
const checkIfCacheExists = (cacheKey) => __awaiter(void 0, void 0, void 0, function* () {
const client = getOctokitClient();
try {
const issueResult = yield client.request(`/repos/${github_1.context.repo.owner}/${github_1.context.repo.repo}/actions/caches`);
const caches = issueResult.data['actions_caches'] || [];
return Boolean(caches.find(cache => cache['key'] === cacheKey));
const cachesResult = yield client.rest.actions.getActionsCacheList({
owner: github_1.context.repo.owner,
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) {
core.debug(`Error checking if cache exist: ${error.message}`);
@@ -1659,8 +1663,11 @@ const resetCacheWithOctokit = (cacheKey) => __awaiter(void 0, void 0, void 0, fu
const client = getOctokitClient();
core.debug(`remove cache "${cacheKey}"`);
try {
// TODO: replace with client.rest.
yield client.request(`DELETE /repos/${github_1.context.repo.owner}/${github_1.context.repo.repo}/actions/caches?key=${cacheKey}`);
yield client.rest.actions.deleteActionsCacheByKey({
owner: github_1.context.repo.owner,
repo: github_1.context.repo.repo,
key: cacheKey
});
}
catch (error) {
if (error.status) {

18
package-lock.json generated
View File

@@ -33,7 +33,7 @@
"jest": "^29.6.2",
"jest-circus": "^29.5.0",
"jest-silent-reporter": "^0.5.0",
"js-yaml": "^4.1.1",
"js-yaml": "^4.1.0",
"prettier": "^2.8.7",
"standard-version": "^9.3.1",
"terminal-link": "^2.1.1",
@@ -428,7 +428,6 @@
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.5.tgz",
"integrity": "sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g==",
"dev": true,
"peer": true,
"dependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.23.5",
@@ -1489,7 +1488,6 @@
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.2.4.tgz",
"integrity": "sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ==",
"peer": true,
"dependencies": {
"@octokit/auth-token": "^3.0.0",
"@octokit/graphql": "^5.0.0",
@@ -1935,7 +1933,6 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.2.tgz",
"integrity": "sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==",
"dev": true,
"peer": true,
"dependencies": {
"@eslint-community/regexpp": "^4.5.1",
"@typescript-eslint/scope-manager": "6.13.2",
@@ -1971,7 +1968,6 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.2.tgz",
"integrity": "sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==",
"dev": true,
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "6.13.2",
"@typescript-eslint/types": "6.13.2",
@@ -2152,7 +2148,6 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
"integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
"dev": true,
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -2467,7 +2462,6 @@
"url": "https://github.com/sponsors/ai"
}
],
"peer": true,
"dependencies": {
"caniuse-lite": "^1.0.30001565",
"electron-to-chromium": "^1.4.601",
@@ -3432,7 +3426,6 @@
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz",
"integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==",
"dev": true,
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -4882,7 +4875,6 @@
"resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
"integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==",
"dev": true,
"peer": true,
"dependencies": {
"@jest/core": "^29.7.0",
"@jest/types": "^29.6.3",
@@ -5493,11 +5485,10 @@
"license": "MIT"
},
"node_modules/js-yaml": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
@@ -7501,7 +7492,6 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz",
"integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==",
"dev": true,
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"

View File

@@ -61,7 +61,7 @@
"jest": "^29.6.2",
"jest-circus": "^29.5.0",
"jest-silent-reporter": "^0.5.0",
"js-yaml": "^4.1.1",
"js-yaml": "^4.1.0",
"prettier": "^2.8.7",
"standard-version": "^9.3.1",
"terminal-link": "^2.1.1",

View File

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