Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async getClosableIssues () {
const {owner, repo} = this.context.repo()
const {daysUntilClose, responseRequiredLabel} = this.config
const q = `repo:${owner}/${repo} is:issue is:open label:"${responseRequiredLabel}"`
const params = {q, sort: 'updated', order: 'desc', per_page: 30}
const labeledEarlierThan = this.since(daysUntilClose)
const issues = await this.github.search.issues(params)
const closableIssues = scramjet.fromArray(issues.data.items).filter(async issue => {
const event = await this.findLastLabeledEvent(owner, repo, issue.number)
const creationDate = new Date(event.created_at)
return creationDate < labeledEarlierThan
}).toArray()
return closableIssues
}