Skip to content

Commit

Permalink
Merge pull request #90 from kwonoj/refacotr-executor
Browse files Browse the repository at this point in the history
refactor(Executor): clarify result message status
  • Loading branch information
orta committed Jan 8, 2017
2 parents a5d37ee + fefbaf4 commit e11d898
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions source/runner/Executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,20 @@ export class Executor {
}

// Delete the message if there's nothing to say
const hasMessages =
results.fails.length > 0 ||
results.warnings.length > 0 ||
results.messages.length > 0 ||
results.markdowns.length > 0
const {fails, warnings, messages, markdowns} = results

if (!hasMessages) {
console.log("All Good.")
const failureCount = [...fails, ...warnings].length
const messageCount = [...messages, ...markdowns].length

if (failureCount + messageCount === 0) {
console.log("No messages are collected.")
await this.platform.deleteMainComment()
} else {
console.log("Failed")
if (failureCount > 0) {
console.log("Found some validation failure")
} else if (messageCount > 0) {
console.log("Found some message, writing it down")
}
const comment = githubResultsTemplate(results)
await this.platform.updateOrCreateComment(comment)
}
Expand Down

0 comments on commit e11d898

Please sign in to comment.