aboutsummaryrefslogtreecommitdiff
path: root/semantic/tasks/config/admin/github.js
diff options
context:
space:
mode:
authorFuwn <[email protected]>2020-12-14 23:21:39 -0800
committerFuwn <[email protected]>2020-12-14 23:21:39 -0800
commit823344c19094680e80e2b56449a243e183db8b06 (patch)
tree92277700547ea671331828caa258ace7aaaa46d5 /semantic/tasks/config/admin/github.js
parentrepo: angular (diff)
downloadme-823344c19094680e80e2b56449a243e183db8b06.tar.xz
me-823344c19094680e80e2b56449a243e183db8b06.zip
:star:
Diffstat (limited to 'semantic/tasks/config/admin/github.js')
-rw-r--r--semantic/tasks/config/admin/github.js37
1 files changed, 37 insertions, 0 deletions
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;