Skip to content

Commit

Permalink
fix: coverage github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
micha37-martins committed Sep 3, 2024
1 parent 506c51c commit 9912184
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/github-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@ jobs:
- name: Update README.md with coverage badge
run: |
sed -i 's|https:\/\/img\.shields\.io\/badge\/Coverage-[0-9]*\(\.[0-9]*\)\?%25-brightgreen|https:\/\/img\.shields\.io\/badge\/Coverage-65.2%25-brightgreen|g' README.md
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add README.md # Ensure README.md is staged
git commit -m "Update coverage badge"
git push origin ${GITHUB_REF#refs/heads/}
current_coverage=$(grep -oP '(?<=Coverage-)\d+\.\d+(?=%25)' README.md)
if [[ "$current_coverage" != "$coverage" ]]; then
sed -i 's|https:\/\/img\.shields\.io\/badge\/Coverage-[0-9]*\(\.[0-9]*\)\?%25-brightgreen|https:\/\/img\.shields\.io\/badge\/Coverage-$coverage%25-brightgreen|g' README.md
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add README.md # Ensure README.md is staged
git commit -m "Update coverage badge"
git push origin ${GITHUB_REF#refs/heads/}
else
echo "Coverage percentage has not changed. Skipping update."
fi

0 comments on commit 9912184

Please sign in to comment.