feat: fetch data for prs that need retest
This commit is contained in:
21
src/lib/create_repo.mjs
Normal file
21
src/lib/create_repo.mjs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user