check-pull-request
v0.0.1
Published
Boilerplate for a simple Serverless GitHub Pull Request Check WebHook
Downloads
4
Readme
check-pull-request
Using AWS Lambda you can make super-simple Pull Request Checks:
Usage
check(opts, handler);
opts
const opts = {
appName: 'My App',
appId: // from GitHub,
secret: // set up with GitHub,
bucket: // provision an S3 bucket to store a certificate for authenticating,
key: // and specify the key
};
handler
const handler = async pr =>
/*
pr is an object that has properties such as repo, owner, headSha, baseRef
and helper functions:
getBody() - gets the body of the Pull Request
getHeadContent(path) -- gets the file at HEAD
getBaseContent(path) -- gets the file at the base
*/
handler
can return false
to avoid providing a Status Check.
Example
'use strict';
const check = require('check-pull-request');
module.exports.handler = check(opts, async pr => {
return {
conclusion: 'neutral',
title: 'No opinion',
summary: 'I did not check anything because I am an example!',
};
});