Slide 18
Slide 18 text
GitHub Review Bot
• AWS Lambda + SNS
• npm github
• Preview版APIも使える
• GraphQLなv4には未対
応
// eval_items: {approve: , body: } を返すPromise
// p_r: Amazon SNS で受信したPullRequest object
(eval_items, p_r) => {
Promise.all(eval_items)
.then(results => {
let approve =
results.map(r => { return r.approve; })
.reduce((x,y) => { return x && y; });
let body =
approve ? MSG_OK : MSG_NG;
return github.pullRequests.createReview({
owner: ‘xxxx’,
repo: p_r.head.repo.name,
number: p_r.number,
body: body,
event: approve ? ‘APPROVE’ : ‘REQUEST_CHANGES’
})
});
}