Skip to content

Commit 55ea206

Browse files
committed
chore: update coverage badge in README and add GitHub Actions workflow for badge generation
1 parent ab32de2 commit 55ea206

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Generate code coverage badge
2+
on:
3+
push:
4+
branches:
5+
- M6/feat/v1
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
name: Update coverage badge
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
fetch-depth: 0
15+
- name: Setup go
16+
uses: actions/setup-go@v4
17+
with:
18+
go-version: '1.24'
19+
- name: Test
20+
run: |
21+
go test -v ./... -covermode=count -coverprofile=coverage.out
22+
go tool cover -func=coverage.out -o=coverage.out
23+
- name: Go Coverage Badge
24+
uses: tj-actions/coverage-badge-go@v3
25+
with:
26+
filename: coverage.out
27+
- name: Verify Changed files
28+
uses: tj-actions/verify-changed-files@v20
29+
id: verify-changed-files
30+
with:
31+
files: README.md
32+
- name: Commit changes
33+
if: steps.verify-changed-files.outputs.files_changed == 'true'
34+
run: |
35+
git config --local user.email "action@github.com"
36+
git config --local user.name "GitHub Action"
37+
git add README.md
38+
git commit -m "chore: Updated coverage badge."
39+
- name: Push changes
40+
if: steps.verify-changed-files.outputs.files_changed == 'true'
41+
uses: ad-m/github-push-action@master
42+
with:
43+
github_token: ${{ secrets.GITHUB_TOKEN }}
44+
branch: ${{ github.ref_name }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![CI](https://github.com/Mathious6/platekit/actions/workflows/ci.yml/badge.svg)](https://github.com/Mathious6/platekit/actions)
44
[![Go Reference](https://pkg.go.dev/badge/github.com/Mathious6/platekit.svg)](https://pkg.go.dev/github.com/Mathious6/platekit)
5-
[![Coverage Status](https://coveralls.io/repos/github/Mathious6/platekit/badge.svg?branch=main)](https://coveralls.io/github/Mathious6/platekit?branch=main)
5+
[![Coverage Status](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Mathious6/PLATEKIT_COVERAGE_GIST/raw/coverage-badge.json)](https://github.com/Mathious6/platekit/actions/workflows/coverage-badge.yml)
66

77
Go library to generate deterministic random license‑plate strings (format `XX-000-000-XX`) from seeds or input strings.
88

0 commit comments

Comments
 (0)