File tree 5 files changed +63
-4
lines changed 5 files changed +63
-4
lines changed Original file line number Diff line number Diff line change 48
48
# Optional: show only new issues if it's a pull request. The default value is `false`.
49
49
# only-new-issues: true
50
50
51
- # Optional: if set to true then the action will use pre-installed Go
51
+ # Optional: if set to true then the action will use pre-installed Go.
52
52
# skip-go-installation: true
53
+
54
+ # Optional: if set to true then the action don't cache or restore ~/go/pkg.
55
+ # skip-pkg-cache: true
56
+
57
+ # Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
58
+ # skip-build-cache: true
53
59
```
54
60
55
61
We recommend running this action in a job separate from other jobs (` go test ` , etc)
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ inputs:
24
24
description : " if set to true then action uses pre-installed Go"
25
25
default : false
26
26
required : true
27
+ skip-pkg-cache :
28
+ description : " if set to true then the action don't cache or restore ~/go/pkg."
29
+ default : false
30
+ required : true
31
+ skip-build-cache :
32
+ description : " if set to true then the action don't cache or restore ~/.cache/go-build."
33
+ default : false
34
+ required : true
27
35
runs :
28
36
using : " node12"
29
37
main : " dist/run/index.js"
Original file line number Diff line number Diff line change @@ -49992,7 +49992,22 @@ const getLintCacheDir = () => {
49992
49992
};
49993
49993
const getCacheDirs = () => {
49994
49994
// Not existing dirs are ok here: it works.
49995
- return [getLintCacheDir(), path_1.default.resolve(`${process.env.HOME}/.cache/go-build`), path_1.default.resolve(`${process.env.HOME}/go/pkg`)];
49995
+ const skipPkgCache = core.getInput(`skip-pkg-cache`, { required: true }).trim();
49996
+ const skipBuildCache = core.getInput(`skip-build-cache`, { required: true }).trim();
49997
+ const dirs = [getLintCacheDir()];
49998
+ if (skipBuildCache.toLowerCase() == "true") {
49999
+ core.info(`Omitting ~/.cache/go-build from cache directories`);
50000
+ }
50001
+ else {
50002
+ dirs.push(path_1.default.resolve(`${process.env.HOME}/.cache/go-build`));
50003
+ }
50004
+ if (skipPkgCache.toLowerCase() == "true") {
50005
+ core.info(`Omitting ~/go/pkg from cache directories`);
50006
+ }
50007
+ else {
50008
+ dirs.push(path_1.default.resolve(`${process.env.HOME}/go/pkg`));
50009
+ }
50010
+ return dirs;
49996
50011
};
49997
50012
const getIntervalKey = (invalidationIntervalDays) => {
49998
50013
const now = new Date();
Original file line number Diff line number Diff line change @@ -50002,7 +50002,22 @@ const getLintCacheDir = () => {
50002
50002
};
50003
50003
const getCacheDirs = () => {
50004
50004
// Not existing dirs are ok here: it works.
50005
- return [getLintCacheDir(), path_1.default.resolve(`${process.env.HOME}/.cache/go-build`), path_1.default.resolve(`${process.env.HOME}/go/pkg`)];
50005
+ const skipPkgCache = core.getInput(`skip-pkg-cache`, { required: true }).trim();
50006
+ const skipBuildCache = core.getInput(`skip-build-cache`, { required: true }).trim();
50007
+ const dirs = [getLintCacheDir()];
50008
+ if (skipBuildCache.toLowerCase() == "true") {
50009
+ core.info(`Omitting ~/.cache/go-build from cache directories`);
50010
+ }
50011
+ else {
50012
+ dirs.push(path_1.default.resolve(`${process.env.HOME}/.cache/go-build`));
50013
+ }
50014
+ if (skipPkgCache.toLowerCase() == "true") {
50015
+ core.info(`Omitting ~/go/pkg from cache directories`);
50016
+ }
50017
+ else {
50018
+ dirs.push(path_1.default.resolve(`${process.env.HOME}/go/pkg`));
50019
+ }
50020
+ return dirs;
50006
50021
};
50007
50022
const getIntervalKey = (invalidationIntervalDays) => {
50008
50023
const now = new Date();
Original file line number Diff line number Diff line change @@ -25,7 +25,22 @@ const getLintCacheDir = (): string => {
25
25
26
26
const getCacheDirs = ( ) : string [ ] => {
27
27
// Not existing dirs are ok here: it works.
28
- return [ getLintCacheDir ( ) , path . resolve ( `${ process . env . HOME } /.cache/go-build` ) , path . resolve ( `${ process . env . HOME } /go/pkg` ) ]
28
+ const skipPkgCache = core . getInput ( `skip-pkg-cache` , { required : true } ) . trim ( )
29
+ const skipBuildCache = core . getInput ( `skip-build-cache` , { required : true } ) . trim ( )
30
+ const dirs = [ getLintCacheDir ( ) ]
31
+
32
+ if ( skipBuildCache . toLowerCase ( ) == "true" ) {
33
+ core . info ( `Omitting ~/.cache/go-build from cache directories` )
34
+ } else {
35
+ dirs . push ( path . resolve ( `${ process . env . HOME } /.cache/go-build` ) )
36
+ }
37
+ if ( skipPkgCache . toLowerCase ( ) == "true" ) {
38
+ core . info ( `Omitting ~/go/pkg from cache directories` )
39
+ } else {
40
+ dirs . push ( path . resolve ( `${ process . env . HOME } /go/pkg` ) )
41
+ }
42
+
43
+ return dirs
29
44
}
30
45
31
46
const getIntervalKey = ( invalidationIntervalDays : number ) : string => {
You can’t perform that action at this time.
0 commit comments