Allow to disable caching completely (#351)

* Add skip-cache parameter

* Update README

* Implement cache skipping

* Run prettier

* update descriptions

* re-build dist

Co-authored-by: Sergey Vilgelm <sergey@vilgelm.com>
This commit is contained in:
Tomas Dabasinskas 2022-02-26 18:16:23 +02:00 committed by GitHub
parent 7d5614c3eb
commit cdfc708aeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 0 deletions

View File

@ -55,6 +55,10 @@ jobs:
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

View File

@ -20,6 +20,12 @@ inputs:
description: "if set to true and the action runs on a pull request - the action outputs only newly found issues"
default: false
required: true
skip-cache:
description: |
if set to true then the all caching functionality will be complete disabled,
takes precedence over all other caching options.
default: false
required: true
skip-pkg-cache:
description: "if set to true then the action doesn't cache or restore ~/go/pkg."
default: false

View File

@ -65066,6 +65066,8 @@ function buildCacheKeys() {
}
function restoreCache() {
return __awaiter(this, void 0, void 0, function* () {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true")
return;
if (!utils.isValidEvent()) {
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
return;
@ -65104,6 +65106,8 @@ function restoreCache() {
exports.restoreCache = restoreCache;
function saveCache() {
return __awaiter(this, void 0, void 0, function* () {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true")
return;
// Validate inputs, this can cause task failure
if (!utils.isValidEvent()) {
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);

4
dist/run/index.js vendored
View File

@ -65066,6 +65066,8 @@ function buildCacheKeys() {
}
function restoreCache() {
return __awaiter(this, void 0, void 0, function* () {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true")
return;
if (!utils.isValidEvent()) {
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
return;
@ -65104,6 +65106,8 @@ function restoreCache() {
exports.restoreCache = restoreCache;
function saveCache() {
return __awaiter(this, void 0, void 0, function* () {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true")
return;
// Validate inputs, this can cause task failure
if (!utils.isValidEvent()) {
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);

View File

@ -72,6 +72,8 @@ async function buildCacheKeys(): Promise<string[]> {
}
export async function restoreCache(): Promise<void> {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") return
if (!utils.isValidEvent()) {
utils.logWarning(
`Event Validation Error: The event type ${process.env[Events.Key]} is not supported because it's not tied to a branch or tag ref.`
@ -112,6 +114,8 @@ export async function restoreCache(): Promise<void> {
}
export async function saveCache(): Promise<void> {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") return
// Validate inputs, this can cause task failure
if (!utils.isValidEvent()) {
utils.logWarning(