Skip to content

Commit

Permalink
Merge pull request #799 from mikepenz/fix/798
Browse files Browse the repository at this point in the history
Fix failure if no tests were found (but `requireTests` is `false`)
  • Loading branch information
mikepenz authored Feb 17, 2023
2 parents 204f987 + e5268cc commit 4604e7a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion 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.

4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ export async function run(): Promise<void> {
const foundResults = mergedResult.totalCount > 0 || mergedResult.skipped > 0
if (!foundResults && requireTests) {
core.setFailed(`❌ No test results found for ${checkName}`)
return // end if we failed due to no tests, but configured to require tests
}

const pullRequest = github.context.payload.pull_request
const link = (pullRequest && pullRequest.html_url) || github.context.ref
const conclusion: 'success' | 'failure' =
mergedResult.totalCount > 0 && mergedResult.failed <= 0 ? 'success' : 'failure'
const conclusion: 'success' | 'failure' = mergedResult.failed <= 0 ? 'success' : 'failure'
const headSha = commit || (pullRequest && pullRequest.head.sha) || github.context.sha
core.info(`ℹ️ Posting with conclusion '${conclusion}' to ${link} (sha: ${headSha})`)

Expand Down

0 comments on commit 4604e7a

Please sign in to comment.