Skip to content

Commit

Permalink
Allow to disable caching completely (#351)
Browse files Browse the repository at this point in the history
* Add skip-cache parameter

* Update README

* Implement cache skipping

* Run prettier

* update descriptions

* re-build dist

Co-authored-by: Sergey Vilgelm <sergey@vilgelm.com>
  • Loading branch information
tdabasinskas and SVilgelm authored Feb 26, 2022
1 parent 7d5614c commit cdfc708
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions dist/post_run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.`);
Expand Down
4 changes: 4 additions & 0 deletions dist/run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.`);
Expand Down
4 changes: 4 additions & 0 deletions src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit cdfc708

Please sign in to comment.