Skip to content

Commit b10b9ae

Browse files
committed
fix: add a go-test option to upload coverage artifacts
This is to fix a breaking change in the v4 artifact upload action. It requires unique names for uploads, but if the action is called multiple times in a run it will hit this error. Options are have a unique name per run, or simply not do the upload. I expect a future action that simply does test coverage will would be a simpler option if needed.
1 parent 12c9a58 commit b10b9ae

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/reusable-go-test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ on:
1212
type: string
1313
description: |
1414
extra args to pass `go test`
15+
upload:
16+
required: false
17+
default: false
18+
type: boolean
19+
description: |
20+
set to true to push test coverage as an artifact
21+
1522
jobs:
1623
go-test:
1724
runs-on: ubuntu-latest
@@ -41,7 +48,7 @@ jobs:
4148
go tool cover -html=/tmp/coverage.out -o /tmp/coverage.html
4249
- name: Upload test log
4350
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
44-
if: always()
51+
if: ${{ inputs.upload }}
4552
with:
4653
name: test-results
4754
path: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ jobs:
607607
uses: GeoNet/Actions/.github/workflows/reusable-go-test.yml@main
608608
```
609609

610-
test coverage results upload to job artifacts, found at the bottom of a job summary page.
610+
test coverage results can be uploaded to job artifacts, found at the bottom of a job summary page.
611611

612612
### Go vulnerability check
613613

0 commit comments

Comments
 (0)