Skip to content

Commit

Permalink
Fail the action if no test results are processed
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Dorner committed Feb 18, 2021
1 parent 93c3964 commit 8efb156
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
needs: build-test
steps:
- uses: actions/checkout@v2
- run: sleep 60
- uses: ./
with:
artifact: test-results
Expand Down
5 changes: 5 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ class TestReporter {

if (this.failOnError && isFailed) {
core.setFailed(`Failed test has been found and 'fail-on-error' option is set to ${this.failOnError}`)
return
}

if (results.length === 0) {
core.setFailed(`No test results file has been processed`)
return
}
}

Expand Down

0 comments on commit 8efb156

Please sign in to comment.