1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-05-11 19:49:53 +02:00

Enhancement: Allow usage when GITHUB_REF or ACTIONS_CACHE_REF are defined

This commit is contained in:
Andreas Möller 2020-05-16 23:05:56 +02:00
parent 16a133d9a7
commit 77fd223211
No known key found for this signature in database
GPG key ID: 9FB20A0BAF60E11F
7 changed files with 792 additions and 638 deletions

15
dist/restore/index.js vendored
View file

@ -3345,10 +3345,16 @@ function resolvePaths(patterns) {
});
}
exports.resolvePaths = resolvePaths;
// Cache token authorized for all events that are tied to a ref
// Cache token authorized for events where a reference is defined
// See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
function isValidEvent() {
return constants_1.RefKey in process.env && Boolean(process.env[constants_1.RefKey]);
for (let i = 0; i < constants_1.RefKeys.length; i++) {
let refKey = constants_1.RefKeys[i];
if (refKey in process.env) {
return Boolean(process.env[refKey]);
}
}
return false;
}
exports.isValidEvent = isValidEvent;
function unlinkFile(path) {
@ -4607,7 +4613,10 @@ var CompressionMethod;
// over the socket during this period, the socket is destroyed and the download
// is aborted.
exports.SocketTimeout = 5000;
exports.RefKey = "GITHUB_REF";
exports.RefKeys = [
"ACTIONS_CACHE_REF",
"GITHUB_REF",
];
/***/ }),

15
dist/save/index.js vendored
View file

@ -3345,10 +3345,16 @@ function resolvePaths(patterns) {
});
}
exports.resolvePaths = resolvePaths;
// Cache token authorized for all events that are tied to a ref
// Cache token authorized for events where a reference is defined
// See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
function isValidEvent() {
return constants_1.RefKey in process.env && Boolean(process.env[constants_1.RefKey]);
for (let i = 0; i < constants_1.RefKeys.length; i++) {
let refKey = constants_1.RefKeys[i];
if (refKey in process.env) {
return Boolean(process.env[refKey]);
}
}
return false;
}
exports.isValidEvent = isValidEvent;
function unlinkFile(path) {
@ -4694,7 +4700,10 @@ var CompressionMethod;
// over the socket during this period, the socket is destroyed and the download
// is aborted.
exports.SocketTimeout = 5000;
exports.RefKey = "GITHUB_REF";
exports.RefKeys = [
"ACTIONS_CACHE_REF",
"GITHUB_REF",
];
/***/ }),