Skip to content

Commit a284939

Browse files
authored
ci: post comments when coverage fails (#120)
1 parent 05b572b commit a284939

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
- name: check test coverage
5151
id: coverage
5252
uses: vladopajic/go-test-coverage@v2
53+
continue-on-error: true # Should fail after coverage comment is posted
5354
with:
5455
config: ./.github/.testcoverage.yml
5556
profile: cover.ubuntu-latest.profile,cover.macos-latest.profile
@@ -88,4 +89,9 @@ jobs:
8889
```
8990
${{ fromJSON(steps.coverage.outputs.report) }}
9091
```
91-
edit-mode: replace
92+
edit-mode: replace
93+
94+
- name: "finally check coverage"
95+
if: steps.coverage.outcome == 'failure'
96+
shell: bash
97+
run: echo "coverage check failed" && exit 1

docs/github_action.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Here is an example of how to post comments with the coverage report to your pull
4848
- name: check test coverage
4949
id: coverage
5050
uses: vladopajic/go-test-coverage@v2
51+
continue-on-error: true # Should fail after coverage comment is posted
5152
with:
5253
config: ./.github/.testcoverage.yml
5354
@@ -84,4 +85,9 @@ Here is an example of how to post comments with the coverage report to your pull
8485
${{ fromJSON(steps.coverage.outputs.report) }}
8586
```
8687
edit-mode: replace
88+
89+
- name: "finally check coverage"
90+
if: steps.coverage.outcome == 'failure'
91+
shell: bash
92+
run: echo "coverage check failed" && exit 1
8793
```

0 commit comments

Comments
 (0)