Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding config to fail the PR checks #10

Closed
chrsr opened this issue Oct 20, 2021 · 4 comments
Closed

Adding config to fail the PR checks #10

chrsr opened this issue Oct 20, 2021 · 4 comments
Assignees
Labels
feature request New feature or request

Comments

@chrsr
Copy link
Contributor

chrsr commented Oct 20, 2021

Can we add an option to "fail" the PR if the coverage does not meet the expected threshold? Although I guess we could just use: https://docs.gradle.org/current/userguide/jacoco_plugin.html#sec:jacoco_report_violation_rules

If I get time I'll raise a PR.

@swapnilpandey03
Copy link

Has this been implemented? if yes can someone please tell me how?

@thsaravana
Copy link
Member

As mentioned in #21 , the action returns two outputs "coverage-overall" and "coverage-changed-files", so you could add another step to your workflow and fail the PR based on these values (whichever is the one that you want).

I am still thinking if we should have a config within the jacoco-report action to fail the step, if it doesn't meet the expected threshold. What would be the threshold? Should it be based on "coverage-overall" or "coverage-changed-files" ?

@thsaravana thsaravana self-assigned this Sep 10, 2022
@thsaravana thsaravana added the feature request New feature or request label Sep 10, 2022
@thsaravana
Copy link
Member

thsaravana commented Sep 10, 2022

You can refer this PR for on how to make use of the "outputs" to fail a PR if it doesn't meet the threshold: thsaravana/jacoco-playground#16
The workflow file: https://github.com/thsaravana/jacoco-playground/actions/runs/3026912615/workflow

@thsaravana
Copy link
Member

The problem here is "on what criteria should we fail". In the next release, I am planning to add "coverage-diff". So different users can choose to Fail the PR based on different conditions. I think a better option would be just to Output these values from the Action, and then users can and a simple step (as mentioned above) on when to fail based on the output values. So closing this. I will update the README.md with the step on how to use the Output values to fail the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants