File tree Expand file tree Collapse file tree 2 files changed +59
-1
lines changed
Expand file tree Collapse file tree 2 files changed +59
-1
lines changed Original file line number Diff line number Diff line change 1+ name : coverage
2+
3+ on :
4+ push :
5+ branches : [main, develop]
6+ pull_request :
7+ branches : [main]
8+
9+ permissions :
10+ contents : write
11+ pull-requests : read
12+
13+ jobs :
14+ coverage :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Checkout
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
21+ persist-credentials : false
22+
23+ - name : Setup Go
24+ uses : actions/setup-go@v4
25+ with :
26+ go-version : 1.24.2
27+
28+ - name : Run tests
29+ run : |
30+ go test ./... -covermode=count -coverpkg=./... -coverprofile=coverage.out
31+ go tool cover -func=coverage.out -o coverage.out
32+
33+ - name : Generate coverage badge
34+ uses : tj-actions/coverage-badge-go@v2
35+ with :
36+ filename : coverage.out
37+
38+ - name : Verify changed files
39+ id : verify
40+ uses : tj-actions/verify-changed-files@v16
41+ with :
42+ files : README.md
43+
44+ - name : Commit badge
45+ if : steps.verify.outputs.files_changed == 'true'
46+ run : |
47+ git config user.email "[email protected] " 48+ git config user.name "GitHub Action"
49+ git add README.md
50+ git commit -m "chore: update coverage badge"
51+
52+ - name : Push badge
53+ if : steps.verify.outputs.files_changed == 'true'
54+ uses : ad-m/github-push-action@master
55+ with :
56+ github_token : ${{ secrets.GITHUB_TOKEN }}
57+ branch : ${{ github.head_ref || github.ref_name }}
58+
Original file line number Diff line number Diff line change 77[ ![ Unit Tests] ( https://github.com/prequel-dev/cre/actions/workflows/build.yml/badge.svg )] ( https://github.com/prequel-dev/cre/actions/workflows/build.yml )
88[ ![ Unit Tests] ( https://github.com/prequel-dev/preq/actions/workflows/build.yml/badge.svg )] ( https://github.com/prequel-dev/preq/actions/workflows/build.yml )
99[ ![ Unit Tests] ( https://github.com/prequel-dev/prequel-compiler/actions/workflows/build.yml/badge.svg )] ( https://github.com/prequel-dev/prequel-compiler/actions/workflows/build.yml )
10- Test coverage: 19.6%
10+ [ ![ Coverage ] ( https://img.shields.io/badge/Coverage-0%25-red.svg )] ( https://github.com/prequel-dev/preq/actions/workflows/coverage.yml )
1111
1212---
1313
You can’t perform that action at this time.
0 commit comments