From 3a3375a3a8adcf38eb15c8a59bafccda942dbd96 Mon Sep 17 00:00:00 2001 From: Anna Sas Date: Thu, 27 Aug 2026 12:26:41 +0200 Subject: [PATCH 1/2] Fix coverage badge push and setup git in workflow Configure Git in shared-coverage workflow so pushes work in CI (mark workspace safe, fetch origin core, and set upstream). Add robust error handling in scripts/coverage_report.py: check git push result, print stderr on failure, and exit non-zero when push fails. Ensures badge commits are pushed reliably and failures are surfaced. --- .github/workflows/shared-coverage.yml | 8 ++++++++ scripts/coverage_report.py | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/shared-coverage.yml b/.github/workflows/shared-coverage.yml index 2e6ab23b7..4565a84ea 100644 --- a/.github/workflows/shared-coverage.yml +++ b/.github/workflows/shared-coverage.yml @@ -52,6 +52,14 @@ jobs: path: cs-coverage merge-multiple: true + - name: Setup Git for Push + shell: bash + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + git remote set-branches origin '*' + git fetch origin core + git branch --set-upstream-to=origin/core core || true + - name: Generate Coverage Report shell: pwsh run: | diff --git a/scripts/coverage_report.py b/scripts/coverage_report.py index f225eded6..75f90d676 100644 --- a/scripts/coverage_report.py +++ b/scripts/coverage_report.py @@ -222,7 +222,10 @@ def git_commit_badges(badge_branch: str, ref_name: str) -> None: diff = run(["git", "diff", "--staged", "--quiet"]) if diff.returncode != 0: run(["git", "commit", "-m", "ci: update coverage badges"]) - run(["git", "push", "origin", f"HEAD:{target}"]) + result = run(["git", "push", "origin", f"HEAD:{target}"]) + if result.returncode != 0: + print(f"ERROR: git push failed:\n{result.stderr}", flush=True) + raise SystemExit(1) print(f"Committed and pushed badge updates to {target}") else: print("No badge changes to commit") From 764c38a2301dd5e0e063934579c0916d94e16b88 Mon Sep 17 00:00:00 2001 From: Anna Sas Date: Thu, 27 Aug 2026 12:27:44 +0200 Subject: [PATCH 2/2] Update shared-coverage.yml --- .github/workflows/shared-coverage.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shared-coverage.yml b/.github/workflows/shared-coverage.yml index 4565a84ea..ba387c8a8 100644 --- a/.github/workflows/shared-coverage.yml +++ b/.github/workflows/shared-coverage.yml @@ -54,11 +54,13 @@ jobs: - name: Setup Git for Push shell: bash + env: + BADGE_BRANCH: ${{ inputs.badge_branch || github.ref_name }} run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" git remote set-branches origin '*' - git fetch origin core - git branch --set-upstream-to=origin/core core || true + git fetch origin "$BADGE_BRANCH" + git branch --set-upstream-to="origin/$BADGE_BRANCH" "$BADGE_BRANCH" || true - name: Generate Coverage Report shell: pwsh