File tree 3 files changed +31
-2
lines changed 3 files changed +31
-2
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 @@ -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
+ var 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