Skip to content

Commit

Permalink
fix: Fix pushing backend code coverage badge to separate branch
Browse files Browse the repository at this point in the history
  • Loading branch information
drikusroor committed Dec 7, 2023
1 parent 3e0f6cd commit b2df0cc
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ jobs:
- name: Generate Backend Coverage Report (XML)
run: |
sudo docker-compose --env-file .env-github-actions run server bash -c "coverage xml"
sudo docker-compose --env-file .env-github-actions run server bash -c "genbadge coverage -i coverage.xml -o coverage-backend-badge.svg"
- name: Checkout code-coverage-badges branch
run: |
git checkout -b code-coverage-badges
git pull origin code-coverage-badges || true # ignore error if branch does not exist
- name: Copy XML Backend Coverage Badge
sudo docker-compose --env-file .env-github-actions run server bash -c "genbadge coverage -i coverage.xml -o coverage-backend-badge-new.svg"
- name: Push Backend Coverage Badge to separate branch
run: |
if git ls-remote --heads origin code-coverage-badges; then
git fetch origin code-coverage-badges
git checkout code-coverage-badges
else
git checkout -b code-coverage-badges
git push origin code-coverage-badges
fi
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add coverage-backend-badge.svg
git commit -m "Add backend coverage badge"
rm backend/coverage-backend-badge.svg -f
mv backend/coverage-backend-badge-new.svg backend/coverage-backend-badge.svg
git add backend/coverage-backend-badge.svg
git commit -m "Add backend coverage badge for commit $GITHUB_SHA"
git push origin code-coverage-badges
frontend-test:
Expand Down

0 comments on commit b2df0cc

Please sign in to comment.