Skip to content

Add coverage report as a PR check run - #386

Open
dmarcelino wants to merge 3 commits into
Madrapps:mainfrom
dmarcelino:checks
Open

dmarcelino wants to merge 3 commits into
Madrapps:mainfrom
dmarcelino:checks

Conversation

@dmarcelino

@dmarcelino dmarcelino commented Sep 24, 2026 •

Copy link
Copy Markdown

Hi @thsaravana , thanks for the jacoco-report! It has been helpful. Recently I've found the need to have it as PR check instead of a comment, hence this PR. Review it and do let me know if you need any changes.

Summary

Publishes the coverage report as a GitHub check run on the head commit, in addition to (or instead of) the PR comment / workflow summary.

New inputs

  • add-check (default false): creates a check run named after title (fallback JaCoCo Report). The check title shows the overall coverage plus the delta when coverage dropped, e.g. Overall 69.09% (-1.07%); the check body reuses the existing comment markdown. Requires the checks: write permission.
  • fail-check-below-threshold (default false): marks the check as failed when overall or changed-lines coverage is below the configured minimum. Requires add-check.
  • comment-type gains a none option (must be combined with add-check: true, otherwise there is nothing to publish).

Behaviour notes

  • A missing checks: write permission (403 from the API) fails the action regardless of continue-on-error, with a message telling the user which permission to add.
  • skip-if-no-changes only suppresses the comment and workflow summary; the check run is still published.

Refactor

  • Input parsing and validation extracted from action.ts into src/inputs.ts.
  • Coverage pass/fail evaluation lives in src/status.ts; comment / summary / check publishing split into src/publish/{comment,summary,check}.ts.
  • Token is masked in debug-mode input logging.

Tests / build / docs

  • New tests: inputs, status, publish_check, action_check.
  • tslib added as a dev dependency (required by the rollup typescript plugin); dist/ rebuilt.
  • README: new inputs, checks: write permission, updated example, and two check-run screenshots.

Note for reviewers: .gitignore also gains .codegraph (a local tooling ignore). Happy to drop it if you'd rather not have it upstream.

- New inputs: add-check, fail-check-below-threshold; comment-type gains none
- Check title shows overall coverage with a pass/fail symbol; body reuses the comment markdown
- Missing checks: write permission fails the action regardless of continue-on-error
- skip-if-no-changes only suppresses comment and summary, the check is still published
- Split action.ts into inputs, status and publish modules
- Mask token in debug-mode input logging
- Add tslib dev dependency required by the rollup typescript plugin; rebuild dist
@dmarcelino
dmarcelino marked this pull request as ready for review September 24, 2026 21:18
# Conflicts:
#	package-lock.json
#	package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant