diff --git a/.github/workflows/mc_dc_coverage.yml b/.github/workflows/mc_dc_coverage.yml index a84e4466..9e1b2862 100644 --- a/.github/workflows/mc_dc_coverage.yml +++ b/.github/workflows/mc_dc_coverage.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 # Fetch full history + fetch-depth: 0 # Fetch full history for branch operations # Install dependencies and setup environment - name: Install Dependencies @@ -63,22 +63,15 @@ jobs: curl -o coverage/line-coverage-badge.svg "https://img.shields.io/badge/line%20coverage-${LINE_COVERAGE_PERCENT}%25-brightgreen" curl -o coverage/branch-coverage-badge.svg "https://img.shields.io/badge/branch%20coverage-${BRANCH_COVERAGE_PERCENT}%25-brightgreen" - # Fix detached HEAD state - - name: Fix Detached HEAD - run: git checkout -B ${GITHUB_REF##*/} - working-directory: ${{ github.workspace }} - - # Commit badges to a separate branch + # Commit badges to the current branch - name: Commit Coverage Badges - if: ${{ github.event_name == 'push' }} run: | git config user.name "github-actions" git config user.email "actions@github.com" - git checkout -b badges || git checkout badges git add coverage/line-coverage-badge.svg git add coverage/branch-coverage-badge.svg git commit -m "Update coverage badges" - git push origin badges + git push origin HEAD working-directory: ${{ github.workspace }} # Upload consolidated coverage report as an artifact