Skip to content

Commit fd6867e

Browse files
committed
add report comment
1 parent d37ca2c commit fd6867e

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,27 @@ jobs:
2020
run: go mod tidy
2121
- name: Run tests with coverage
2222
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
23-
- name: Upload coverage to Codecov
24-
uses: codecov/codecov-action@v5
23+
- name: Upload coverage
24+
uses: actions/upload-artifact@v4
2525
with:
26-
files: coverage.txt
27-
token: ${{ secrets.CODECOV_TOKEN }}
26+
name: code-coverage
27+
path: cover.out # Make sure to use the same file name you chose for the "-coverprofile" in the "Test" step
2828
- name: Check coverage
2929
uses: vladopajic/go-test-coverage@v2
3030
with:
3131
config: ./.testcoverage.yml
32+
- name: Archive code coverage results
33+
code_coverage:
34+
name: "Code coverage report"
35+
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch
36+
runs-on: ubuntu-latest
37+
needs: test # Depends on the artifact uploaded by the "unit_tests" job
38+
permissions:
39+
contents: read
40+
actions: read # to download code coverage results from "test" job
41+
pull-requests: write # write permission needed to comment on PR
42+
steps:
43+
- uses: fgrosse/[email protected] # Consider using a Git revision for maximum security
44+
with:
45+
coverage-artifact-name: "code-coverage" # can be omitted if you used this default value
46+
coverage-file-name: "cover.out" # can be omitted if you used this default value

0 commit comments

Comments
 (0)