diff --git a/lib/plugins/rulesets.js b/lib/plugins/rulesets.js index de68c384..6846e1ce 100644 --- a/lib/plugins/rulesets.js +++ b/lib/plugins/rulesets.js @@ -53,17 +53,18 @@ module.exports = class Rulesets extends Diffable { }) this.log(listOptions) return this.github.paginate(listOptions) - .filter(ruleset => ruleset.source_type === 'Repository') .then(res => { - const rulesets = res.map(ruleset => { - const getOptions = this.github.request.endpoint.merge('GET /repos/{owner}/{repo}/rulesets/{id}', { - owner: this.repo.owner, - repo: this.repo.repo, - id: ruleset.id, - headers: version + const rulesets = res + .filter(ruleset => ruleset.source_type === 'Repository') + .map(ruleset => { + const getOptions = this.github.request.endpoint.merge('GET /repos/{owner}/{repo}/rulesets/{id}', { + owner: this.repo.owner, + repo: this.repo.repo, + id: ruleset.id, + headers: version + }) + return this.github.paginate(getOptions) }) - return this.github.paginate(getOptions) - }) return Promise.all(rulesets).then(res => { return res ? res.flat(1) : [] })