mirror of
https://github.com/actions/stale.git
synced 2026-02-11 08:38:17 +00:00
Compare commits
2 Commits
v10.1.1
...
09bde159b3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09bde159b3 | ||
|
|
a21a081629 |
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) {
|
||||||
|
|||||||
9
package-lock.json
generated
9
package-lock.json
generated
@@ -5698,10 +5698,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lodash": {
|
"node_modules/lodash": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.23",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
|
||||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
"integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/lodash.deburr": {
|
"node_modules/lodash.deburr": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
|
|||||||
@@ -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