GitHub: add job ID to cache key

To avoid the problem where multiple jobs try to create the same cache
entry, we add the GitHub job ID to the cache key.
The two restore keys make it possible that a job can also restore a
cache entry from another job if none for the current job exist yet.
This commit is contained in:
Oliver Gugger
2023-01-06 08:58:42 +01:00
parent 984fc3a2ec
commit a074c801d1

View File

@@ -27,8 +27,9 @@ runs:
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-
${{ runner.os }}-go-${{ inputs.go-version }}-
- name: set GOPATH