Skip to content

Commit 27dedfe

Browse files
tiborpilzTibor Pilz
authored and
Tibor Pilz
committed
ci: create test coverage badge
1 parent de15cce commit 27dedfe

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/test.yml

+33
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,36 @@ jobs:
3737
env:
3838
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
3939
BADGE_PATH: ${{ steps.extract_branch.outputs.branch }}/test-badge.svg
40+
41+
- name: Generate the badge SVG image
42+
uses: emibcn/[email protected]
43+
id: badge
44+
with:
45+
label: 'Test coverage'
46+
status: ${{ steps.coverage.outputs.lines }}
47+
color: 'blue,555,daf'
48+
path: ${{ steps.coverage.outputs.path }}
49+
50+
- name: Upload badge as artifact
51+
uses: actions/upload-artifact@v3
52+
with:
53+
name: badge
54+
path: ${{ steps.coverage.outputs.path }}
55+
if-no-files-found: error
56+
57+
- name: Commit badge
58+
continue-on-error: true
59+
env:
60+
BADGE: ${{ steps.coverage.outputs.path }}
61+
run: |
62+
git config --local user.email "[email protected]"
63+
git config --local user.name "GitHub Action"
64+
git add "${BADGE}"
65+
git commit -m "Add/Update badge"
66+
67+
- name: Push badge commit
68+
uses: ad-m/github-push-action@master
69+
if: ${{ success() }}
70+
with:
71+
github_token: ${{ secrets.GITHUB_TOKEN }}
72+
branch: ${{ steps.coverage.outputs.branch }}

0 commit comments

Comments
 (0)