autobounty/bot/github.js

19 lines
449 B
JavaScript
Raw Normal View History

2018-01-22 16:49:04 +01:00
'use strict'
const octokit = require('@octokit/rest')()
2018-01-22 16:49:04 +01:00
// Returns all the bounty labelNames of a given issue (Github API v3)
async function getLabels (req) {
const labelsPayload = await octokit.issues.getIssueLabels({
owner: req.body.repository.owner.login,
repo: req.body.repository.name,
number: req.body.issue.number
2018-03-19 23:02:24 +01:00
})
return labelsPayload.data.map(labelObj => labelObj.name)
2018-01-22 16:49:04 +01:00
}
2018-01-22 21:21:31 +01:00
module.exports = {
2018-03-19 23:02:24 +01:00
getLabels: getLabels
2018-01-22 21:21:31 +01:00
}