fixing ADR with new input

This commit is contained in:
Dmitry Shibanov 2022-04-06 10:06:21 +02:00
parent d0fcad0b2b
commit 38571befd5
1 changed files with 28 additions and 2 deletions

View File

@ -18,16 +18,18 @@ We don't pursue the goal to provide wide customization of caching in scope of `a
# Decision
- Add `cache` input parameter to `actions/setup-go`. For now, input will accept the following values:
- `true` - enable caching for go dependencies
- `false` and `''` - disable caching for go dependencies. This value will be set as default value
We're planning to get these values as strings. That will enable us to extend the functionality in future much easier if we get proposals for it.
- `false`- disable caching for go dependencies. This value will be set as default value
- Cache feature will be disabled by default to make sure that we don't break existing customers. We will consider enabling cache by default in next major releases
- Action will try to search a go.sum files in the repository and throw error in the scenario that it was not found
- The hash of found file will be used as cache key (the same approach like [actions/cache](https://github.com/actions/cache/blob/main/examples.md#go---modules) recommends)
- The following key cache will be used `${{ runner.os }}-go${{ go-version }}-${{ hashFiles('<go.sum-path>') }}`
- Action will cache global cache from the `go env GOCACHE` command
- Add a `cache-dependency-path` input parameter to `actions/setup-go`. The new input will accept an array or regex of dependency files. The field will accept a path (relative to the repository root) to dependency files. If the provided path contains wildcards, the action will search all matching files and calculate a common hash like the ${{ hashFiles('**/go.sum') }} YAML construction does.
# Example of real use-cases
- With cache
```yml
steps:
- uses: actions/checkout@v3
@ -37,6 +39,30 @@ steps:
cache: true
```
- With cache-dependency-path
```yml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '16'
cache: true
cache-dependency-path: **/go.sum
```
```yml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '16'
cache: true
cache-dependency-path: |
**/go.sum
**/go.mod
```
# Release process
As soon as functionality is implemented, we will release minor update of action. No need to bump major version since there are no breaking changes for existing users.