chore: update coverage badge in README and add GitHub Actions workflo… #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Generate code coverage badge | |
| on: | |
| push: | |
| branches: | |
| - M6/feat/v1 | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| name: Update coverage badge | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Setup go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.24' | |
| - name: Test | |
| run: | | |
| go test -v ./... -covermode=count -coverprofile=coverage.out | |
| go tool cover -func=coverage.out -o=coverage.out | |
| - name: Go Coverage Badge | |
| uses: tj-actions/coverage-badge-go@v3 | |
| with: | |
| filename: coverage.out | |
| - name: Verify Changed files | |
| uses: tj-actions/verify-changed-files@v20 | |
| 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: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref_name }} |