Skip to content

Commit cdfc708

Browse files
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>
1 parent 7d5614c commit cdfc708

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ jobs:
5555
# Optional: show only new issues if it's a pull request. The default value is `false`.
5656
# only-new-issues: true
5757

58+
# Optional: if set to true then the all caching functionality will be complete disabled,
59+
# takes precedence over all other caching options.
60+
# skip-cache: true
61+
5862
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
5963
# skip-pkg-cache: true
6064

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ inputs:
2020
description: "if set to true and the action runs on a pull request - the action outputs only newly found issues"
2121
default: false
2222
required: true
23+
skip-cache:
24+
description: |
25+
if set to true then the all caching functionality will be complete disabled,
26+
takes precedence over all other caching options.
27+
default: false
28+
required: true
2329
skip-pkg-cache:
2430
description: "if set to true then the action doesn't cache or restore ~/go/pkg."
2531
default: false

dist/post_run/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65066,6 +65066,8 @@ function buildCacheKeys() {
6506665066
}
6506765067
function restoreCache() {
6506865068
return __awaiter(this, void 0, void 0, function* () {
65069+
if (core.getInput(`skip-cache`, { required: true }).trim() == "true")
65070+
return;
6506965071
if (!utils.isValidEvent()) {
6507065072
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.`);
6507165073
return;
@@ -65104,6 +65106,8 @@ function restoreCache() {
6510465106
exports.restoreCache = restoreCache;
6510565107
function saveCache() {
6510665108
return __awaiter(this, void 0, void 0, function* () {
65109+
if (core.getInput(`skip-cache`, { required: true }).trim() == "true")
65110+
return;
6510765111
// Validate inputs, this can cause task failure
6510865112
if (!utils.isValidEvent()) {
6510965113
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.`);

dist/run/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65066,6 +65066,8 @@ function buildCacheKeys() {
6506665066
}
6506765067
function restoreCache() {
6506865068
return __awaiter(this, void 0, void 0, function* () {
65069+
if (core.getInput(`skip-cache`, { required: true }).trim() == "true")
65070+
return;
6506965071
if (!utils.isValidEvent()) {
6507065072
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.`);
6507165073
return;
@@ -65104,6 +65106,8 @@ function restoreCache() {
6510465106
exports.restoreCache = restoreCache;
6510565107
function saveCache() {
6510665108
return __awaiter(this, void 0, void 0, function* () {
65109+
if (core.getInput(`skip-cache`, { required: true }).trim() == "true")
65110+
return;
6510765111
// Validate inputs, this can cause task failure
6510865112
if (!utils.isValidEvent()) {
6510965113
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.`);

src/cache.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ async function buildCacheKeys(): Promise<string[]> {
7272
}
7373

7474
export async function restoreCache(): Promise<void> {
75+
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") return
76+
7577
if (!utils.isValidEvent()) {
7678
utils.logWarning(
7779
`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> {
112114
}
113115

114116
export async function saveCache(): Promise<void> {
117+
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") return
118+
115119
// Validate inputs, this can cause task failure
116120
if (!utils.isValidEvent()) {
117121
utils.logWarning(

0 commit comments

Comments
 (0)