fix: addComment and labler issues

This commit is contained in:
Randell Dawson
2018-11-09 21:58:12 -08:00
committed by mrugesh mohapatra
parent ade0b9a53f
commit 76c23be416
2 changed files with 17 additions and 26 deletions

View File

@@ -5,17 +5,18 @@ const octokit = require('@octokit/rest')(octokitConfig);
octokit.authenticate(octokitAuth);
const addComment = (number, comment) => {
setTimeout(async () => {
octokit.issues.createComment({ owner, repo, number, body: comment })
.then(() => {
console.log(`PR #${number} successfully added a comment\n`);
})
.catch((err) => {
console.log(`PR #${number} had an error when trying to add a comment\n`);
console.log(err)
})
}, 1000); // wait one second to comment for API rate limiting compliance
const addComment = async (number, comment) => {
const result = await octokit.issues.createComment({ owner, repo, number, body: comment })
.catch((err) => {
console.log(`PR #${number} had an error when trying to add a comment\n`);
console.log(err)
});
if (result) {
console.log(`PR #${number} successfully added a comment\n`);
}
return result;
};
exports.addComment = addComment;
module.exports = { addComment };