From 0c24343c82777cdbe6cbbaa6819f0d25c2ada64b Mon Sep 17 00:00:00 2001 From: Julien Bisconti Date: Tue, 29 May 2018 00:07:41 +0200 Subject: [PATCH] Prevent running script without a token --- fetchRepos.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fetchRepos.js b/fetchRepos.js index be2b65b..31e3d7c 100644 --- a/fetchRepos.js +++ b/fetchRepos.js @@ -5,6 +5,10 @@ process.on('unhandledRejection', error => { console.log('unhandledRejection', error.message); }); +if (!process.env.TOKEN) { + throw new Error('no github token found'); +} + const readme = 'README.md'; const API = 'https://api.github.com/'; const options = {