feat: fetch data for prs that need retest

This commit is contained in:
2018-10-17 15:56:11 -07:00
parent b6b5c27ffc
commit d1cfd7c20b
8 changed files with 164 additions and 4 deletions

21
src/lib/create_repo.mjs Normal file
View File

@@ -0,0 +1,21 @@
/* eslint no-console: 0 */
import Octokat from 'octokat';
function usageError() {
console.error('You must provide a github repo in the form of "owner/repo"');
process.exit(1);
}
export default function(repo) {
if (typeof repo !== 'string' || repo.length === 0) usageError();
const settings = {
token: process.env.GITHUB_ACCESS_TOKEN,
};
const octo = new Octokat(settings);
const [owner, name] = repo.split('/');
if (!owner || !name) usageError();
return octo.repos(owner, name);
}