mirror of
https://github.com/actions/stale.git
synced 2026-01-09 08:48:18 +00:00
Compare commits
3 Commits
dependabot
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a21a081629 | ||
|
|
997185467f | ||
|
|
5611b9defa |
2
.github/workflows/e2e-tests.yml
vendored
2
.github/workflows/e2e-tests.yml
vendored
@@ -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:
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 }}
|
||||||
|
|||||||
17
dist/index.js
vendored
17
dist/index.js
vendored
@@ -1646,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}`);
|
||||||
@@ -1659,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) {
|
||||||
|
|||||||
18
package-lock.json
generated
18
package-lock.json
generated
@@ -33,7 +33,7 @@
|
|||||||
"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",
|
||||||
@@ -428,7 +428,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.5.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.5.tgz",
|
||||||
"integrity": "sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g==",
|
"integrity": "sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ampproject/remapping": "^2.2.0",
|
"@ampproject/remapping": "^2.2.0",
|
||||||
"@babel/code-frame": "^7.23.5",
|
"@babel/code-frame": "^7.23.5",
|
||||||
@@ -1489,7 +1488,6 @@
|
|||||||
"version": "4.2.4",
|
"version": "4.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.2.4.tgz",
|
||||||
"integrity": "sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ==",
|
"integrity": "sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/auth-token": "^3.0.0",
|
"@octokit/auth-token": "^3.0.0",
|
||||||
"@octokit/graphql": "^5.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",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.2.tgz",
|
||||||
"integrity": "sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==",
|
"integrity": "sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.5.1",
|
"@eslint-community/regexpp": "^4.5.1",
|
||||||
"@typescript-eslint/scope-manager": "6.13.2",
|
"@typescript-eslint/scope-manager": "6.13.2",
|
||||||
@@ -1971,7 +1968,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.2.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.2.tgz",
|
||||||
"integrity": "sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==",
|
"integrity": "sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "6.13.2",
|
"@typescript-eslint/scope-manager": "6.13.2",
|
||||||
"@typescript-eslint/types": "6.13.2",
|
"@typescript-eslint/types": "6.13.2",
|
||||||
@@ -2152,7 +2148,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
|
||||||
"integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
|
"integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -2467,7 +2462,6 @@
|
|||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"caniuse-lite": "^1.0.30001565",
|
"caniuse-lite": "^1.0.30001565",
|
||||||
"electron-to-chromium": "^1.4.601",
|
"electron-to-chromium": "^1.4.601",
|
||||||
@@ -3432,7 +3426,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz",
|
||||||
"integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==",
|
"integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.6.1",
|
"@eslint-community/regexpp": "^4.6.1",
|
||||||
@@ -4882,7 +4875,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
|
||||||
"integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==",
|
"integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jest/core": "^29.7.0",
|
"@jest/core": "^29.7.0",
|
||||||
"@jest/types": "^29.6.3",
|
"@jest/types": "^29.6.3",
|
||||||
@@ -5493,11 +5485,10 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/js-yaml": {
|
"node_modules/js-yaml": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"argparse": "^2.0.1"
|
"argparse": "^2.0.1"
|
||||||
},
|
},
|
||||||
@@ -7501,7 +7492,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz",
|
||||||
"integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==",
|
"integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
"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",
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user