Skip to content

Commit 273e3f1

Browse files
authored
Adds a check with code coverage report: (#50)
- With a check it's possible to always see the code coverage results regardless of the workflow event type - Code Coverage threshold status is always reported on the check regardless of `fail_below_threshold` setting. This allows setting branch protection checks regardless of workflow status - supports push event as well No longer fails workflow if PR cannot be determined.
1 parent 61b3b14 commit 273e3f1

File tree

9 files changed

+699
-6969
lines changed

9 files changed

+699
-6969
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@ artifacts to circumvent this. See the workflows in this project for an implement
1919

2020
## How it looks like
2121

22+
A comment is added to the pull request with the coverage report.
23+
2224
![alt text](img/comment.png "Pull request comment with metrics")
2325

26+
A check is added to the workflow run.
27+
28+
![alt text](img/check.png "Check with metrics")
29+
30+
The check will suceed or fail based on your threshold, this allows you to mandate coverage checks pass on your [protected branches](https://docs.github.com/en/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches).
31+
2432
## Inputs
2533

2634
### `repo_token` **Required**
@@ -79,6 +87,8 @@ Use a unique name for the report and comment.
7987

8088
Pull request number associated with the report. This property should be used when workflow trigger is different than `pull_request`.
8189

90+
If no pull request can determine the action will skip adding the comment.
91+
8292
## Example usage
8393

8494
```yaml

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ inputs:
4040
required: false
4141
default: ''
4242
only_changed_files:
43-
description: 'Only show coverage for changed files.'
43+
description: 'Only show coverage for changed files. (only if a PR is present)'
4444
required: true
4545
default: false
4646
pull_request_number:

dist/index.js

+525-122
Large diffs are not rendered by default.

img/check.png

76.8 KB
Loading

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ const { action } = require("./src/action");
44

55
action(github.context.payload).catch((error) => {
66
// Action threw an error. Fail the action with the error message.
7+
core.debug(error.stack);
78
core.setFailed(error.message);
89
});

0 commit comments

Comments
 (0)