Commit 22f50f6 1 parent 767b3f7 commit 22f50f6 Copy full SHA for 22f50f6
File tree 9 files changed +52
-16
lines changed
9 files changed +52
-16
lines changed Original file line number Diff line number Diff line change 94
94
with :
95
95
scarb-lock : ./subdir/Scarb.lock
96
96
97
+ - name : " Setup Scarb with caching disabled"
98
+ uses : ./
99
+ with :
100
+ cache : false
101
+
97
102
- name : " Create .tool-versions file"
98
103
run : echo "scarb 0.7.0" >> .tool-versions
99
104
- name : " Setup Scarb using `.tool-versions` file"
Original file line number Diff line number Diff line change 36
36
- ` scarb-lock` - **Optional**. String.
37
37
- Stating a relative or absolute path to the `Scarb.lock` file used for caching dependencies.
38
38
- Empty/not specified : ` Scarb.lock` in the working directory will be used.
39
+ - ` cache` - **Optional**. Boolean.
40
+ - Enables caching Scarb dependencies.
41
+ - Empty/not specified : ` true` .
39
42
40
43
# # Outputs
41
44
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ inputs:
14
14
scarb-lock :
15
15
description : Path to Scarb.lock file
16
16
required : false
17
+ cache :
18
+ description : Enable dependency caching
19
+ required : false
20
+ default : " true"
17
21
outputs :
18
22
scarb-prefix :
19
23
description : The prefix of the installed Scarb
Original file line number Diff line number Diff line change @@ -73723,6 +73723,13 @@ async function getScarbLockPath(scarbLockPath) {
73723
73723
73724
73724
73725
73725
async function saveCache() {
73726
+ const enableCache = core.getBooleanInput("cache");
73727
+
73728
+ if (!enableCache) {
73729
+ core.info(`Caching disabled, not saving cache.`);
73730
+ return;
73731
+ }
73732
+
73726
73733
try {
73727
73734
const primaryKey = core.getState(State.CachePrimaryKey);
73728
73735
const matchedKey = core.getState(State.CacheMatchedKey);
Original file line number Diff line number Diff line change @@ -74854,6 +74854,7 @@ async function main() {
74854
74854
const scarbVersionInput = core.getInput("scarb-version");
74855
74855
const toolVersionsPathInput = core.getInput("tool-versions");
74856
74856
const scarbLockPathInput = core.getInput("scarb-lock");
74857
+ const enableCache = core.getBooleanInput("cache");
74857
74858
74858
74859
const { repo: scarbRepo, version: scarbVersion } = await determineVersion(
74859
74860
scarbVersionInput,
@@ -74887,13 +74888,17 @@ async function main() {
74887
74888
74888
74889
core.setOutput("scarb-version", await getFullVersionFromScarb());
74889
74890
74890
- await restoreCache(scarbLockPathInput).catch((e) => {
74891
- core.error(
74892
- `There was an error when restoring cache: ${
74893
- e instanceof Error ? e.message : e
74894
- }`,
74895
- );
74896
- });
74891
+ if (enableCache) {
74892
+ await restoreCache(scarbLockPathInput).catch((e) => {
74893
+ core.error(
74894
+ `There was an error when restoring cache: ${
74895
+ e instanceof Error ? e.message : e
74896
+ }`,
74897
+ );
74898
+ });
74899
+ } else {
74900
+ core.info(`Caching disabled, not restoring cache.`);
74901
+ }
74897
74902
} catch (e) {
74898
74903
core.setFailed(e);
74899
74904
}
Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ import * as cache from "@actions/cache";
4
4
import { getCacheDirectory , State } from "./cache-utils" ;
5
5
6
6
async function saveCache ( ) {
7
+ const enableCache = core . getBooleanInput ( "cache" ) ;
8
+
9
+ if ( ! enableCache ) {
10
+ core . info ( `Caching disabled, not saving cache.` ) ;
11
+ return ;
12
+ }
13
+
7
14
try {
8
15
const primaryKey = core . getState ( State . CachePrimaryKey ) ;
9
16
const matchedKey = core . getState ( State . CacheMatchedKey ) ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export default async function main() {
15
15
const scarbVersionInput = core . getInput ( "scarb-version" ) ;
16
16
const toolVersionsPathInput = core . getInput ( "tool-versions" ) ;
17
17
const scarbLockPathInput = core . getInput ( "scarb-lock" ) ;
18
+ const enableCache = core . getBooleanInput ( "cache" ) ;
18
19
19
20
const { repo : scarbRepo , version : scarbVersion } = await determineVersion (
20
21
scarbVersionInput ,
@@ -48,13 +49,17 @@ export default async function main() {
48
49
49
50
core . setOutput ( "scarb-version" , await getFullVersionFromScarb ( ) ) ;
50
51
51
- await restoreCache ( scarbLockPathInput ) . catch ( ( e ) => {
52
- core . error (
53
- `There was an error when restoring cache: ${
54
- e instanceof Error ? e . message : e
55
- } `,
56
- ) ;
57
- } ) ;
52
+ if ( enableCache ) {
53
+ await restoreCache ( scarbLockPathInput ) . catch ( ( e ) => {
54
+ core . error (
55
+ `There was an error when restoring cache: ${
56
+ e instanceof Error ? e . message : e
57
+ } `,
58
+ ) ;
59
+ } ) ;
60
+ } else {
61
+ core . info ( `Caching disabled, not restoring cache.` ) ;
62
+ }
58
63
} catch ( e ) {
59
64
core . setFailed ( e ) ;
60
65
}
You can’t perform that action at this time.
0 commit comments