Skip to content

Commit

Permalink
Update the workflow for v0.x with badge push to badge_v0.x branch (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthakn7 authored Oct 22, 2024
1 parent 3dd452a commit 09fe706
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
default: v0.x
required: false
type: string
badge_branch:
description: 'The branch which contains the jacoco badge for above branch'
default: badge_v0.x
required: false
type: string

jobs:
build:
Expand All @@ -20,7 +25,13 @@ jobs:
java: ['21']
name: Java ${{ matrix.Java }} build
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
- name: Checkout badges branch to a badges directory nested inside first checkout
uses: actions/checkout@v2
with:
ref: ${{ inputs.badge_branch }}
path: badges
- name: Setup java
uses: actions/setup-java@v2
with:
Expand All @@ -36,6 +47,7 @@ jobs:
id: jacoco
uses: cicirello/[email protected]
with:
badges-directory: badges
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
- name: Log coverage percentage
run: |
Expand All @@ -44,14 +56,14 @@ jobs:
- name: Commit and push badge
if: ${{ github.event_name != 'pull_request' }}
run: |
cd .github/badges
cd badges
if [[ `git status --porcelain *.svg` ]]; then
git config --global user.name github_actions
git add *.svg
git commit -m "Autogenerated JaCoCo coverage badge" *.svg
git pull --rebase origin ${{ inputs.branch }}
git push
fi
cd ..
- name: Upload JaCoCo coverage report
uses: actions/upload-artifact@v4
with:
Expand Down

0 comments on commit 09fe706

Please sign in to comment.