helpers.js (660B)
1 const createIssue = (octokit, issueInfo, organization, repository) => { 2 return new Promise((resolve, reject) => { 3 octokit 4 .request( 5 "POST /repos/" + organization + "/" + repository + "/import/issues", 6 issueInfo 7 ) 8 .then( 9 (res) => { 10 // console.log("res", res); 11 if (res.status === 202) { 12 console.log(`Imported issue: ${issueInfo.issue.title}`); 13 resolve(res); 14 } else { 15 // error creating the issue 16 reject(res); 17 } 18 }, 19 (err) => { 20 reject(err); 21 } 22 ); 23 }); 24 }; 25 26 module.exports = { createIssue };