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

Commit 06f3169

Browse files
newnewbz0al
authored andcommitted
fix: Edits first bot comment if found
1 parent 4d1f635 commit 06f3169

File tree

3 files changed

+660
-1283
lines changed

3 files changed

+660
-1283
lines changed

Diff for: lib/lint.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { lint, load } = require('@commitlint/core')
44
// Ours
55
const config = require('./config')
66
const format = require('./format')
7+
const checkComments = require('./comments')
78

89
/**
910
* Runs commitlint against all commits of the pull request and sets an appropriate
@@ -64,7 +65,12 @@ async function commitlint(context) {
6465
// Write a comment with the details (if any)
6566
if (errorsCount > 0 || warnsCount > 0) {
6667
const message = format(report.commits)
67-
await issues.createComment({ ...pull, body: message })
68+
const comment = await checkComments(issues,pull)
69+
if(comment){ // edits previous bot comment if found
70+
await issues.editComment({...pull,id:comment.id,body:message})
71+
}else{ // if no previous comment create a new one
72+
await issues.createComment({ ...pull, body: message })
73+
}
6874
}
6975
})
7076
}

0 commit comments

Comments
 (0)