diff --git a/lib/comments.js b/lib/comments.js new file mode 100644 index 0000000..2115427 --- /dev/null +++ b/lib/comments.js @@ -0,0 +1,18 @@ +/** + * Checks for a previous bot comment, if found returns the commen + */ +async function checkComments(issues,pull){ + const comments = await issues.getComments(pull) + let result +//iterates over all the comments + for (comment of comments['data']){ + if(comment.user.login=='testing-bot[bot]'&&comment.user.type=='Bot'){ //looks for the first comment made by the bot + result = comment + break + } + } + + return result +} + +module.exports = checkComments \ No newline at end of file