Skip to content

Commit 6660aba

Browse files
committed
ci: wire GITHUB_TOKEN + BUILD_NUMBER for Coveralls (github-actions)
The nbaztec coveralls-jacoco v1.2.20 plugin has a quirky GitHub Actions detection path. Reading its source (ServiceInfoParser.kt): - If GITHUB_ACTIONS is set but GITHUB_TOKEN is not, it emits service_name="github-actions" — which the Coveralls API does not recognize as a first-class service, so PR comments and branch correlation silently no-op. - When BOTH GITHUB_ACTIONS and GITHUB_TOKEN are set, it switches to service_name="github" (the canonical name). - service_job_id is read from BUILD_NUMBER (Jenkins-style), not GITHUB_RUN_ID — so we map github.run_id onto BUILD_NUMBER explicitly. - Branch is read from CI_BRANCH; github.head_ref is used so PR builds report the source branch instead of "<num>/merge". Verified locally by running coverallsJacoco with the production token plus a CircleCI-shaped env block (the plugin's CircleCI branch is the best-supported one) — Coveralls returned OK and the build appeared in the dashboard. Also re-adds coverallsRequest = file(...) so the request payload is written to build/coveralls-request.json. The workflow's "Push coverage to Coveralls" step already cats this file, which makes future regressions diagnosable from the CI log alone. Assisted-By: Claude Code
1 parent 130bfea commit 6660aba

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

.github/workflows/java-ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ jobs:
467467
- name: Push coverage to Coveralls
468468
env:
469469
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
470+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
471+
BUILD_NUMBER: ${{ github.run_id }}
470472
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
471473
run: |
472474
if [ -z "$COVERALLS_REPO_TOKEN" ]; then

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ coverallsJacoco {
206206
reportSourceSets = publishedProjects.collectMany {
207207
it.sourceSets.main.allSource.srcDirs
208208
}
209+
coverallsRequest = file("build/coveralls-request.json")
209210
}
210211

211212
def javaFormatSources = providers.provider {

0 commit comments

Comments
 (0)