diff options
| author | Fuwn <[email protected]> | 2020-12-14 23:21:39 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2020-12-14 23:21:39 -0800 |
| commit | 823344c19094680e80e2b56449a243e183db8b06 (patch) | |
| tree | 92277700547ea671331828caa258ace7aaaa46d5 /semantic/tasks/config/admin/github.js | |
| parent | repo: angular (diff) | |
| download | me-823344c19094680e80e2b56449a243e183db8b06.tar.xz me-823344c19094680e80e2b56449a243e183db8b06.zip | |
:star:
Diffstat (limited to 'semantic/tasks/config/admin/github.js')
| -rw-r--r-- | semantic/tasks/config/admin/github.js | 37 |
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; |