Skip to content

Commit 130bfea

Browse files
committed
fix: use github.head_ref for CI_BRANCH in Coveralls integration
For GitHub Actions pull requests, github.ref_name returns the PR reference (e.g., "293/merge") instead of the actual branch name. The coveralls-jacoco plugin uses CI_BRANCH to identify the branch in coverage reports. By using github.head_ref (which provides the branch name for PRs) with github.ref_name as a fallback (for push events), we ensure the correct branch is reported. Assisted-By: Claude Code
1 parent d59a2d2 commit 130bfea

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/java-ci.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,16 @@ jobs:
467467
- name: Push coverage to Coveralls
468468
env:
469469
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
470-
CI_BRANCH: ${{ github.ref_name }}
470+
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
471471
run: |
472472
if [ -z "$COVERALLS_REPO_TOKEN" ]; then
473473
echo "ERROR: COVERALLS_REPO_TOKEN is not set"
474474
exit 1
475475
fi
476-
./gradlew coverallsJacoco
476+
./gradlew coverallsJacoco -i
477+
echo "=== Coveralls request payload ==="
478+
if [ -f build/coveralls-request.json ]; then
479+
cat build/coveralls-request.json | jq . 2>/dev/null || cat build/coveralls-request.json
480+
else
481+
echo "No coveralls-request.json found"
482+
fi

0 commit comments

Comments
 (0)