Skip to content

Commit b0da21c

Browse files
authored
Merge pull request #47 from cli/andyfeller/46-go-mod-support
Add go.mod support
2 parents b2a64f6 + 18f2a52 commit b0da21c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

action.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ inputs:
99
description: "GitHub token to use, defaults to `github.token` if unspecified"
1010
go_version:
1111
description: "The Go version to use for compiling (supports semver spec and ranges)"
12-
default: "1.18"
12+
go_version_file:
13+
description: Path to the go.mod or go.work file to determine version of go to use
1314
gpg_fingerprint:
1415
description: "GPG fingerprint to use for signing releases"
1516
release_tag:
@@ -25,7 +26,13 @@ runs:
2526
# TODO: figure out how to avoid setting up Go for non-Go extensions
2627
- uses: actions/setup-go@v3
2728
with:
28-
go-version: ${{ inputs.go_version }}
29+
# The default go version is managed here because actions/setup-go favors go-version over go-version-file,
30+
# requiring us to only pass it if no other inputs are provided.
31+
#
32+
# Otherwise, we pass along the values given, letting the user catch the warning notice in the logs
33+
# and picking either go-version or go-version-file.
34+
go-version: ${{(inputs.go_version_file == '' && inputs.go_version == '') && '1.18' || inputs.go_version}}
35+
go-version-file: ${{inputs.go_version_file}}
2936

3037
- id: determine_token
3138
run: |

0 commit comments

Comments
 (0)