From 823344c19094680e80e2b56449a243e183db8b06 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 14 Dec 2020 23:21:39 -0800 Subject: :star: --- semantic/tasks/config/admin/github.js | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 semantic/tasks/config/admin/github.js (limited to 'semantic/tasks/config/admin/github.js') diff --git a/semantic/tasks/config/admin/github.js b/semantic/tasks/config/admin/github.js new file mode 100644 index 0000000..a2c9e20 --- /dev/null +++ b/semantic/tasks/config/admin/github.js @@ -0,0 +1,37 @@ +/******************************* + GitHub Login +*******************************/ +/* + Logs into GitHub using OAuth +*/ + +var + fs = require('fs'), + path = require('path'), + githubAPI = require('@octokit/rest'), + + // stores oauth info for GitHub API + oAuthConfig = path.join(__dirname, 'oauth.js'), + oAuth = fs.existsSync(oAuthConfig) + ? require(oAuthConfig) + : false, + github +; + +if(!oAuth) { + console.error('Must add oauth token for GitHub in tasks/config/admin/oauth.js'); +} + +github = new githubAPI({ + version : '3.0.0', + debug : true, + protocol : 'https', + timeout : 5000 +}); + +github.authenticate({ + type: 'oauth', + token: oAuth.token +}); + +module.exports = github; -- cgit v1.2.3