Skip to content

Commit

Permalink
coverage badge
Browse files Browse the repository at this point in the history
  • Loading branch information
James Hutcheon authored and James Hutcheon committed Oct 31, 2023
1 parent e2dac86 commit 029ad01
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,32 @@ jobs:
go-version: '1.21.x'

- name: Test
run: go test -v ./... -coverprofile coverage.out -coverpkg ./...
run: |
go test -v ./... -coverprofile coverage.out -coverpkg ./... -covermode=count
go tool cover -func=coverage.out -o=coverage.out
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
uses: tj-actions/coverage-badge-go@v2
with:
filename: coverage.out

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files
with:
files: README.md

- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: Updated coverage badge."
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.head_ref }}

0 comments on commit 029ad01

Please sign in to comment.