Skip to content

CTHL-5402: coverage #12

CTHL-5402: coverage

CTHL-5402: coverage #12

Workflow file for this run

name: Generate code coverage badge
on:
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
name: Update coverage badge
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.25.5
- uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
persist-credentials: false
fetch-depth: 0
# - name: Checkout
# uses: actions/checkout@v4
# with:
# persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
# fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
#
# - name: Setup go
# uses: actions/setup-go@v4
# with:
# go-version-file: 'go.mod'
- name: Install dependencies
run: make install-dependencies
- name: Install tools
run: make install-tools
- name: Run Test
run: |
make test-verbose-with-coverage-for-budge
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
uses: tj-actions/coverage-badge-go@v3
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 }}