-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.6 KB
/
Copy pathkover-action.yml
File metadata and controls
59 lines (48 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Update Code Coverage Badge
on:
push:
branches:
paths-ignore:
- 'README.md'
jobs:
update-coverage-badge:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Checkout the code
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Run tests and generate coverage report
run: ./gradlew test koverlog
- name: Update Coverage Badge
run: ./gradlew updateCoverageBadge
- name: Set timestamp
run: echo "TIMESTAMP=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
id: extract_branch
- name: Check if coverage badge update is needed
id: check-update
run: |
git diff --exit-code -- README.md || echo "README_CHANGED=true" >> $GITHUB_ENV
- name: Create or Update Pull Request
if: env.README_CHANGED == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.MY_GITHUB_SECRET }}
commit-message: "Update code coverage badge"
title: "Update code coverage badge"
body: "Automated update of the code coverage badge."
branch: "update-coverage-badge-${{ env.TIMESTAMP }}"
base: "main"
delete-branch: true
signoff: false
draft: false
milestone: 1