Skip to content

Produce error instead of silently ignoring empty "go-version" #83

@thaJeztah

Description

@thaJeztah

I'm not sure if it's possible for an action to distinguish between a value not being set or a value being set, but empty / nil, but opening a ticket, just in case. This could also be considered a bug in GitHub actions (more below).

I ran into a bug yesterday in one of our repositories using this action (moby/term#19). The repository had a workflow defined as below (simplified);

strategy:
  matrix:
    go-versions: [1.12.x, 1.13.x, 1.14.x]
steps:
- name: Install Go
  uses: actions/setup-go@v1
  with:
    go-version: ${{ matrix.go-version }}

CI seemed to be running fine, testing all versions:

Screenshot 2020-11-01 at 12 38 59

However, on close inspection, it turned out we were only testing against the latest go version. The reason for that was that the go-version: was empty:

97782034-7c066800-1b8f-11eb-9a57-e6498d247409

The reason was that the matrix defined go-versions (plural), but the action was looking for ${{ matrix.go-version }} (singular), which would be a simple fix;

--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -4,7 +4,7 @@ jobs:
       matrix:
-        go-versions: [1.12.x, 1.13.x, 1.14.x]
+        go-version: [1.12.x, 1.13.x, 1.14.x]
         platform: [ubuntu-latest]

These things can be easy to miss though, as the action is silently ignoring this case; would it be possible to detect this situation and make the action fail ?

Metadata

Metadata

Labels

feature requestNew feature or request to improve the current logic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions