diff --git a/.github/workflows/lint-and-tests.yml b/.github/workflows/lint-and-tests.yml index 560c8a34..ddb103df 100644 --- a/.github/workflows/lint-and-tests.yml +++ b/.github/workflows/lint-and-tests.yml @@ -67,9 +67,23 @@ jobs: ${{ runner.os }}-go- - name: Run Unit Tests run: make test - - name: Publish Unit Test Coverage - uses: codecov/codecov-action@v1 + - name: Archive code coverage results + uses: actions/upload-artifact@v4 with: - flags: unittests - file: cover.out - token: ${{ secrets.CODECOV_TOKEN }} + name: code-coverage + path: cover.out # Make sure to use the same file name you chose for the "-coverprofile" in the "Test" step + + code_coverage: + name: "Code coverage report" + if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch + runs-on: ubuntu-latest + needs: test # Depends on the artifact uploaded by the "unit_tests" job + permissions: + contents: read + actions: read # to download code coverage results from "test" job + pull-requests: write # write permission needed to comment on PR + steps: + - uses: fgrosse/go-coverage-report@v1.1.1 # Consider using a Git revision for maximum security + with: + coverage-artifact-name: "code-coverage" # can be omitted if you used this default value + coverage-file-name: "cover.out" # can be omitted if you used this default value