Skip to content

Commit

Permalink
[fix] Handle Check Collaborator rejection properly
Browse files Browse the repository at this point in the history
  • Loading branch information
decompil3d committed Aug 7, 2019
1 parent 18c7e1f commit d9ea86d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CHANGELOG

- [fix] Check Collaborator rejects on unknown users, so handle that appropriately

## 2.0.0-rc4

- [fix] Handle case with no `.pullierc` file better
Expand Down
17 changes: 10 additions & 7 deletions plugins/reviewers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,16 @@ class ReviewerPlugin {
})));

return await pReduce(maybeUsers, async (memo, user) => {
const res = await context.github.repos.checkCollaborator({
...context.repo(),
username: user
});
const userExists = res.status === 204;

return userExists ? memo.concat([user]) : memo;
try {
const res = await context.github.repos.checkCollaborator({
...context.repo(),
username: user
});

return res.status === 204 ? memo.concat([user]) : memo;
} catch (err) {
return memo;
}
}, []);
}
}
Expand Down

0 comments on commit d9ea86d

Please sign in to comment.