Leverage the built-in cache in setup-go@v4 (#157)
diff --git a/action.yml b/action.yml
index 5c3bf10..690bae8 100644
--- a/action.yml
+++ b/action.yml
@@ -48,30 +48,7 @@
uses: actions/setup-go@v4
with:
go-version: 1.18
- - if: runner.os == 'Linux'
- uses: actions/cache@v3
- with:
- path: |
- ~/.cache/go-build
- ~/go/pkg/mod
- key: license-eye-${{ runner.os }}-go-${{ hashFiles(format('{0}/{1}', github.action_path, 'go.sum')) }}
- restore-keys: license-eye-${{ runner.os }}-go-
- - if: runner.os == 'macOS'
- uses: actions/cache@v3
- with:
- path: |
- ~/Library/Caches/go-build
- ~/go/pkg/mod
- key: license-eye-${{ runner.os }}-go-${{ hashFiles(format('{0}/{1}', github.action_path, 'go.sum')) }}
- restore-keys: license-eye-${{ runner.os }}-go-
- - if: runner.os == 'Windows'
- uses: actions/cache@v3
- with:
- path: |
- ~\AppData\Local\go-build
- ~\go\pkg\mod
- key: license-eye-${{ runner.os }}-go-${{ hashFiles(format('{0}/{1}', github.action_path, 'go.sum')) }}
- restore-keys: license-eye-${{ runner.os }}-go-
+ cache-dependency-path: ${{ github.action_path }}/go.sum
- shell: bash
run: make -C $GITHUB_ACTION_PATH install
- shell: bash
diff --git a/dependency/action.yml b/dependency/action.yml
index ee0cb44..8999902 100644
--- a/dependency/action.yml
+++ b/dependency/action.yml
@@ -42,30 +42,7 @@
uses: actions/setup-go@v4
with:
go-version: 1.18
- - if: runner.os == 'Linux'
- uses: actions/cache@v3
- with:
- path: |
- ~/.cache/go-build
- ~/go/pkg/mod
- key: license-eye-${{ runner.os }}-go-${{ hashFiles(format('{0}/{1}', github.action_path, 'go.sum')) }}
- restore-keys: license-eye-${{ runner.os }}-go-
- - if: runner.os == 'macOS'
- uses: actions/cache@v3
- with:
- path: |
- ~/Library/Caches/go-build
- ~/go/pkg/mod
- key: license-eye-${{ runner.os }}-go-${{ hashFiles(format('{0}/{1}', github.action_path, 'go.sum')) }}
- restore-keys: license-eye-${{ runner.os }}-go-
- - if: runner.os == 'Windows'
- uses: actions/cache@v3
- with:
- path: |
- ~\AppData\Local\go-build
- ~\go\pkg\mod
- key: license-eye-${{ runner.os }}-go-${{ hashFiles(format('{0}/{1}', github.action_path, 'go.sum')) }}
- restore-keys: license-eye-${{ runner.os }}-go-
+ cache-dependency-path: ${{ github.action_path }}/go.sum
- shell: bash
run: make -C $GITHUB_ACTION_PATH/.. install
- shell: bash
diff --git a/header/action.yml b/header/action.yml
index 659f9c8..5ea9f7f 100644
--- a/header/action.yml
+++ b/header/action.yml
@@ -48,30 +48,7 @@
uses: actions/setup-go@v4
with:
go-version: 1.18
- - if: runner.os == 'Linux'
- uses: actions/cache@v3
- with:
- path: |
- ~/.cache/go-build
- ~/go/pkg/mod
- key: license-eye-${{ runner.os }}-go-${{ hashFiles(format('{0}/{1}', github.action_path, 'go.sum')) }}
- restore-keys: license-eye-${{ runner.os }}-go-
- - if: runner.os == 'macOS'
- uses: actions/cache@v3
- with:
- path: |
- ~/Library/Caches/go-build
- ~/go/pkg/mod
- key: license-eye-${{ runner.os }}-go-${{ hashFiles(format('{0}/{1}', github.action_path, 'go.sum')) }}
- restore-keys: license-eye-${{ runner.os }}-go-
- - if: runner.os == 'Windows'
- uses: actions/cache@v3
- with:
- path: |
- ~\AppData\Local\go-build
- ~\go\pkg\mod
- key: license-eye-${{ runner.os }}-go-${{ hashFiles(format('{0}/{1}', github.action_path, 'go.sum')) }}
- restore-keys: license-eye-${{ runner.os }}-go-
+ cache-dependency-path: ${{ github.action_path }}/go.sum
- shell: bash
run: make -C $GITHUB_ACTION_PATH/.. install
- shell: bash