Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
fix: Edits first bot comment if found
Browse files Browse the repository at this point in the history
  • Loading branch information
newnewb authored and z0al committed Jul 8, 2018
1 parent 4d1f635 commit 06f3169
Show file tree
Hide file tree
Showing 3 changed files with 660 additions and 1,283 deletions.
8 changes: 7 additions & 1 deletion lib/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { lint, load } = require('@commitlint/core')
// Ours
const config = require('./config')
const format = require('./format')
const checkComments = require('./comments')

/**
* Runs commitlint against all commits of the pull request and sets an appropriate
Expand Down Expand Up @@ -64,7 +65,12 @@ async function commitlint(context) {
// Write a comment with the details (if any)
if (errorsCount > 0 || warnsCount > 0) {
const message = format(report.commits)
await issues.createComment({ ...pull, body: message })
const comment = await checkComments(issues,pull)
if(comment){ // edits previous bot comment if found
await issues.editComment({...pull,id:comment.id,body:message})
}else{ // if no previous comment create a new one
await issues.createComment({ ...pull, body: message })
}
}
})
}
Expand Down
Loading

0 comments on commit 06f3169

Please sign in to comment.