fix: addComment and labler issues
This commit is contained in:
committed by
mrugesh mohapatra
parent
ade0b9a53f
commit
76c23be416
@@ -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 };
|
||||
|
Reference in New Issue
Block a user