'use strict'; // let github = require('./github.js'); // github.getTag('sarine.viewer.templates.widget', 'v1.11.0').then((tag) => { // console.log('tag.sha: ' + tag[0].commit.sha); // }); var GitHubApi = require("github"); //create API var github = new GitHubApi({}); //auth github.authenticate({ type: "basic", username: process.env.USERNAME, password: process.env.PASSWORD }); //create tag const promise = github.gitdata.createTag({ user: "adica", repo: "sarine.viewer.templates.widget", "tag": "temp", "message": "this is temp tag", "object": "9452a7c65dea101627823c1631d692216efe99b1", "type": "commit", "tagger": { name: "adica", email: "adic@tikalk.com", date: new Date() } }); promise.then((newTag) => { github.gitdata.createReference({
function isOwner (packageName, token, callback) { if (!token) { return callback(null, false); } var githubClient = new GithubClient({ version: '3.0.0' }); githubClient.authenticate({ type: 'oauth', token: token }); function actualCheck(user) { database.getPackage(packageName, function (error, result) { if (error) { return callback({ status: 500, message: 'Database error' }); } if (result.rows.length === 0) { return callback({ status: 404, message: 'Package not found' }); } var pkg = result.rows[0]; var urlParts = url.parse(pkg.url); var pathParts = urlParts.pathname.split('/'); if (urlParts.hostname !== 'github.com' || pathParts.length !== 3 || pathParts[0] !== '') { return callback({ status: 501, message: 'Can only unregister packages hosted on GitHub.com' }); } var owner = pathParts[1]; var repo = path.basename(pathParts[2], '.git'); function ghCheck (next) { return function (error) { if (error) { if (error.code === 404) { return next(); } return callback({ status: error.code, message: JSON.parse(error.message).message }); } callback(null, true); }; } function getNewPath(path, cb) { var url = "http://github.com" + path; request.head(url, function(e, res) { if (e) cb(e); cb(null, res.req.path); }); } getNewPath("/" + owner + "/" + repo, function (error, path) { if (error) { return callback({ status: 500, message: 'Error fetching GitHub repository path' }); } var pathParts = path.split('/'); var owner = pathParts[1]; var repo = pathParts[2]; githubClient.repos.getCollaborator({ user: owner, repo: repo, collabuser: user.login }, ghCheck(function () { callback(null, false); })); }); }); } githubClient.user.get({}, function (error, user) { if (error) { return callback({ status: 500, message: 'Error fetching GitHub user info' }); } if (config.has('registryEditors')) { var editors = config.get('registryEditors').split(','); if (editors.indexOf(user.login) >= 0) { callback(null, true); } else { actualCheck(user); } } else { actualCheck(user); } }); }
var GithubApi = require('github'); var config = require('../../../env/').GITHUB; var github = new GithubApi({ version: '3.0.0', }); github.authenticate({ type: 'oauth', key: config.clientID, secret: config.clientSecret }); module.exports = github;
var fs = require("fs"); var und = require("underscore"); var dsa14 = require("./utils.js"); var ghapi = require("github"); var gh = new ghapi({ version: "3.0.0" }); gh.authenticate({ type: "oauth", token: fs.readFileSync("../my-oauth-token", { encoding: "utf-8" }) }); var names = JSON.parse( fs.readFileSync("../jsons/stugit.json" , { encoding: "utf-8" })).map(function (stu) { return { stu_id: stu.stu_id.toLowerCase(), github_name: stu.github_name }; }); var teams = JSON.parse( fs.readFileSync("../jsons/team_data.json", { encoding: "utf-8" })); var team_id = new Array(); und.each(teams, function (team) { team_id[team.team_data.name] = team.team_data.id; }); var add_error = new Array(), add_ok = new Array();
ttl: 10000 }); const githubApi = new GitHubApi({ debug: false, protocol: 'https', host: 'api.github.com', timeout: 5000, headers: { 'user-agent': 'github-slack-ua' }, followRedirects: false // default: true; there's currently an issue with non-get redirects, so allow ability to disable follow-redirects }); githubApi.authenticate({ type: 'oauth', token: process.env.GITHUB_TOKEN }); function getAllPages(method, options) { options.per_page = 100; return new Promise((resolve, reject) => { githubApi.getAllPages(method, options, (err, res) => { if (err) { reject(err); } else { resolve(res); } }); }); }
authenticate: function(token) { return github.authenticate({ type: 'oauth', token: token }); },
var Github = require('github'); var LRU = require('lru-cache'); var client = new Github({ version: '3.0.0', protocol: 'https' }); var getGithubAccount = require('app/util/github-account'); var ServerActions = require('app/actions/server'); var ComponentStore = require('app/stores/components-store'); var cache = new LRU({ max: 10000, maxAge: 1000 * 60 * 60 }); client.authenticate(config.github); var GithubApi = { getStarCountForModule: function(module, callback) { var moduleName = module.name, starCount = cache.get(moduleName), repo = getGithubAccount(module); if (typeof starCount !== 'undefined') { return setImmediate(callback, null, starCount); } else if (!repo) { return setImmediate(callback, null, 0); } client.repos.get({
build: process.env.TRAVIS_BUILD_NUMBER, }; const github = new Github({ version: '3.0.0', protocol: 'https', timeout: 5000, headers: { 'user-agent': 'ally.js build tool', }, }); github.authenticate({ type: 'oauth', token: data.token, }, function(err) { if (err) { throw err; } }); function setStatus(options, done) { options.user = data.user; options.repo = data.repo; options.sha = data.sha; /*eslint-disable camelcase */ options.target_url = options.url; /*eslint-enable camelcase */ github.statuses.create(options, function(err) { if (err) { throw err; }
} var express = require('express'); var app = express(); var GitHubApi = require("github"); var github = new GitHubApi({ // required version: "3.0.0", headers: { "user-agent": "ICHack-Fix-My-Code" // GitHub is happy with a unique user agent } }); github.authenticate({ type: "oauth", token: process.env.GITHUB_OAUTH_TOKEN }); app.get('/paths', function(req, res) { var user = req.query['user']; var repo = req.query['repo']; Promise.promisify(github.gitdata.getTree)({ user: user, repo: repo, sha: 'master', recursive: true }).then(function(response) { console.log('Getting ghPath list for: ' + user + '/' + repo); var result = response['tree'] .map(function(file) { return user + '/' + repo + '/master/' + file['path'];
const app = express(); const http = require('http').Server(app); const io = require('socket.io')(http); // Elasticsearch const db = new elasticsearch.Client({ host: 'localhost:9200', log: 'trace' }); // GitHub let github = new GitHub({ version: '3.0.0' }); github.authenticate({ type: 'oauth', token: 'dd8fe677b60d5cbb6d0a53713821b60635caf0f5' }); const githubPageSize = 100; // Static: http://expressjs.com/en/starter/static-files.html app.use(express.static('public')); app.get('/', function(req, res) { res.sendfile('index.html'); }); app.use('/build', express.static(path.resolve(__dirname,'../build'))); app.get('/download/:username/cover-letter.pdf', function (req, res, next) { // console.log('although this matches'); let context = req.params; latex.generateCoverLetter('john-doe', context)
const GITHUB_AUTH_TOKEN = process.env.GITHUB_AUTH_TOKEN; const templateFilePath = `${__dirname}/template.md`; const outputFilePath = `${__dirname}/../README.md`; let data = require('./../data.json'); const github = new GitHubApi({ debug: DEBUG, followRedirects: false, timeout: 10000, Promise: Promise }); github.authenticate({ type: "oauth", token: GITHUB_AUTH_TOKEN }); const repositories = data.curated .map(item => { const fetchReposPromise = item.repos .map(repoPath => { const separatedRepoPath = repoPath.split('/'); return github.repos.get({ user: separatedRepoPath[0], repo: separatedRepoPath[1] }); }); return Promise .all(fetchReposPromise)
exports.streamEvents = function(name, singleInput, eventWriter, done) { // Get the checkpoint directory out of the modular input's metadata. var checkpointDir = this._inputDefinition.metadata["checkpoint_dir"]; var owner = singleInput.owner; var repository = singleInput.repository; var token = singleInput.token; var alreadyIndexed = 0; var Github = new GithubAPI({version: "3.0.0"}); if (token && token.length > 0) { Github.authenticate({ type: "oauth", token: token }); } var page = 1; var working = true; Async.whilst( function() { return working; }, function(callback) { try { Github.repos.getCommits({ headers: {"User-Agent": SDK_UA_STRING}, user: owner, repo: repository, per_page: 100, // The maximum per page value supported by the Github API. page: page }, function (err, res) { if (err) { callback(err); return; } // When res.meta.link doesn't contain "next", we should stop the loop after streaming commits on this page. if (res.meta.link.indexOf("rel=\"next\"") < 0) { working = false; } var checkpointFilePath = path.join(checkpointDir, owner + " " + repository + ".txt"); var checkpointFileNewContents = ""; var errorFound = false; // Set the temporary contents of the checkpoint file to an empty string var checkpointFileContents = ""; try { checkpointFileContents = utils.readFile("", checkpointFilePath); } catch (e) { // If there's an exception, assume the file doesn't exist // Create the checkpoint file with an empty string fs.appendFileSync(checkpointFilePath, ""); } for (var i = 0; i < res.length && !errorFound; i++) { var json = { sha: res[i].sha, api_url: res[i].url, url: "https://github.com/" + owner + "/" + repository + "/commit/" + res[i].sha }; // If the file exists and doesn't contain the sha, or if the file doesn't exist. if (checkpointFileContents.indexOf(res[i].sha + "\n") < 0) { var commit = res[i].commit; // At this point, assumed checkpoint doesn't exist. json.message = commit.message.replace(/(\n|\r)+/g, " "); // Replace newlines and carriage returns with spaces. json.author = commit.author.name; json.rawdate = commit.author.date; json.displaydate = getDisplayDate(commit.author.date.replace("T|Z", " ").trim()); try { var event = new Event({ stanza: repository, sourcetype: "github_commits", data: JSON.stringify(json), // Have Splunk index our event data as JSON. time: Date.parse(json.rawdate) // Set the event timestamp to the time of the commit. }); eventWriter.writeEvent(event); checkpointFileNewContents += res[i].sha + "\n"; // Append this commit to the string we'll write at the end Logger.info(name, "Indexed a Github commit with sha: " + res[i].sha); } catch (e) { errorFound = true; working = false; // Stop streaming if we get an error. Logger.error(name, e.message, eventWriter._err); fs.appendFileSync(checkpointFilePath, checkpointFileNewContents); // Write to the checkpoint file done(e); // We had an error, die. return; } } else { // The commit has already been indexed alreadyIndexed++; } } fs.appendFileSync(checkpointFilePath, checkpointFileNewContents); // Write to the checkpoint file if (alreadyIndexed > 0) { Logger.info(name, "Skipped " + alreadyIndexed.toString() + " already indexed Github commits from " + owner + "/" + repository); } page++; alreadyIndexed = 0; callback(); }); } catch (e) { callback(e); } }, function(err) { // We're done streaming. done(err); } ); };
'sha': {key: 'i', args: 1, description: 'commit ID', mandatory: true}, 'state': {key: 's', args: 1, description: 'pending, success, error, or failure', mandatory: true}, 'url': {key: 'l', args: 1, description: 'URL to link'}, 'context': {key: 'c', args: 1, description: 'Test context'}, 'description': {key: 'd', args: 1, description: 'detailed description'}, 'authfile': {key: 'f', args: 1, description: 'authentication file', mandatory: true}, 'debug': {key: 'D', description: 'enable debugging output'}, }); var github = new Client({ debug: ops.debug, version: "3.0.0" }); var authfile = require(ops.authfile); github.authenticate(authfile); function clone(a) { return JSON.parse(JSON.stringify(a)); } function showResult(err, res){ if (err != null) { console.log("Error: " + err); return; } if (ops.debug) { console.log("Result: " + res) } }
var github = new GitHubApi({ // required version: "3.0.0", // optional debug: true, protocol: "https", host: "api.github.com", // should be api.github.com for GitHub pathPrefix: "", // for some GHEs; none for GitHub timeout: 5000, headers: { "user-agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36" // GitHub is happy with a unique user agent } }); github.authenticate({ type: "basic", username: "544262408@qq.com", password: "qq569033569033" }); var stackexchange = require('stackexchange'); var options = { version: 2.2 }; var context = new stackexchange(options); var filter = { key: '1bHwZK)j3oMWIjndaVT*lQ((', pagesize: 50, sort: 'votes',
'priority:medium': '91bfdb', 'priority:high': 'fee090', 'priority:critical': 'fc8d59' } // setup promise handling process.on('unhandledRejection', reason => { // todo error logs console.error(reason) process.exit(1) }) const ghClient = new Github() ghClient.authenticate({ type: 'token', token: token }) const createOrUpdateLabel = ({repo, label, color}) => { ghClient.issues.createLabel({ owner: 'ridewithgps', repo: repo, name: label, color: color }).catch(e => { ghClient.issues.updateLabel({ owner: 'ridewithgps', repo: repo, oldname: label, name: label, color: color
exports.githubSync = function (req, res) { github.authenticate({ type: "oauth", token: res.locals.githubUser.accessToken }); github.user.getOrgs({}, function (err_getOrgs, orgs) { for (var i = orgs.length - 1; i >= 0; i--) { var currentItem = orgs[i]; //add user's organizations new User({ //set organization flag to true isOrganization: true, username: currentItem.login, url: currentItem.url, name: currentItem.login, github_id: currentItem.id, avatar_url: currentItem.avatar_url, location: "", email: "", blog: "", public_repos: "", public_gists: "", last_github_sync: null }).save(); //add user organization relationship new UserOrganization({ userId: res.locals.githubUser.id, username: res.locals.githubUser.login, orgId: currentItem.id, orgName: currentItem.login }).save(); //get organization's repos github.repos.getFromOrg({ org: currentItem.login }, function (err_getRepos, got_repos) { for (var i = got_repos.length - 1; i >= 0; i--) { var objItem = got_repos[i]; //insert new Repository({ github_id: objItem.id, owner: { id: objItem.owner.id, username: objItem.owner.login }, name: objItem.name, html_url: objItem.html_url, clone_url: objItem.clone_url, git_url: objItem.git_url, homepage: objItem.homepage, ssh_url: objItem.ssh_url, language: objItem.language, size: objItem.size, is_fork: objItem.fork, created_at: objItem.created_at }).save(); }; }); }; }); //get user's repos github.repos.getAll({}, function (err, repoObj) { for (var i = 0, arrLen = repoObj.length; i < arrLen; i++) { var objItem = repoObj[i]; new Repository({ github_id: objItem.id, owner: { id: objItem.owner.id, username: objItem.owner.login }, name: objItem.name, html_url: objItem.html_url, clone_url: objItem.clone_url, git_url: objItem.git_url, homepage: objItem.homepage, ssh_url: objItem.ssh_url, language: objItem.language, size: objItem.size, is_fork: objItem.fork, created_at: objItem.created_at }).save(); } //update user's last github sync time User.findOneAndUpdate({ github_id: res.locals.githubUser.id }, { last_github_sync: new Date() }).exec(); res.redirect('/panel?msg=successfully_synced'); }); };
const GitHubApi = require('github'); const { GraphQLClient } = require('graphql-request'); const algoliasearch = require('algoliasearch'); const token = process.env.GITHUB_TOKEN; if (!token && process.env.NODE_ENV === 'production') { throw new Error('No token found. Make sure .env file exists!'); } const ghRestApi = new GitHubApi({ debug: process.env.NODE_ENV !== 'production', }); ghRestApi.authenticate({ type: 'token', token, }); const ghGraphqlApi = new GraphQLClient('https://api.github.com/graphql', { headers: { Authorization: `bearer ${process.env.GITHUB_TOKEN}`, }, }); /** * Algo docs: https://www.algolia.com/doc/api-client/javascript/getting-started/ */ const client = algoliasearch(process.env.ALGOLIA_APP_ID, process.env.ALGOLIA_API_KEY); const algoliaProjectsIndex = client.initIndex('code@nus_projects'); const algoliaUsersIndex = client.initIndex('code@nus_users');
function conventionalGithubReleaser(auth, changelogOpts, context, gitRawCommitsOpts, parserOpts, writerOpts, userCb) { if (!auth) { throw new Error('Expected an auth object'); } var promises = []; var changelogArgs = [changelogOpts, context, gitRawCommitsOpts, parserOpts, writerOpts].map(function(arg) { if (typeof arg === 'function') { userCb = arg; return {}; } else { return arg || {}; } }); if (!userCb) { throw new Error('Expected an callback'); } changelogOpts = changelogArgs[0]; context = changelogArgs[1]; gitRawCommitsOpts = changelogArgs[2]; parserOpts = changelogArgs[3]; writerOpts = changelogArgs[4]; changelogOpts = merge({ pkg: { path: 'package.json', transform: function(pkg) { if (pkg.version && pkg.version[0].toLowerCase() !== 'v') { pkg.version = 'v' + pkg.version; } return pkg; } }, transform: through.obj(function(chunk, enc, cb) { if (typeof chunk.gitTags === 'string') { var match = /tag:\s*(.+?)[,\)]/gi.exec(chunk.gitTags); if (match) { chunk.version = match[1]; } } if (chunk.committerDate) { chunk.committerDate = dateFormat(chunk.committerDate, 'yyyy-mm-dd', true); } cb(null, chunk); }) }, changelogOpts); writerOpts.includeDetails = true; if (changelogOpts.preset) { writerOpts.headerPartial = writerOpts.headerPartial || ''; } github.authenticate(auth); conventionalChangelog(changelogOpts, context, gitRawCommitsOpts, parserOpts, writerOpts) .on('error', function(err) { userCb(err); }) .pipe(through.obj(function(chunk, enc, cb) { var version = (chunk.keyCommit && chunk.keyCommit.version) || context.version; if (!version) { setImmediate(userCb, new Error('Cannot find a version used for the release tag')); return; } var prerelease = semver.parse(version).prerelease.length > 0; var promise = Q.nfcall(github.releases.createRelease, { // jscs:disable owner: context.owner, repo: context.repository, tag_name: version, body: chunk.log, prerelease: prerelease // jscs:enable }); promises.push(promise); cb(); }, function() { Q.allSettled(promises) .then(function(responses) { setImmediate(userCb, null, responses); }); })); }
var mkdirp = require('mkdirp'); var taskist = require('taskist'); var config = require('./config'); var GitHubApi = require('github'); var github = new GitHubApi({ version: '3.0.0', protocol: 'https', timeout: 5000 }); if(config.githubToken) { github.authenticate({ type: 'oauth', token: config.githubToken }); } var tasks = require('./tasks')(config.output, github); if(require.main === module) { main(); } module.exports = main; function main() { handleExit(); async.series([
var auth = function() { github.authenticate({ type: "oauth", token: this.noddy.getConfig().plugins.brancher.token }); };
const args = require('minimist')(process.argv.slice(2), { string: ['tag', 'releaseId'], default: { releaseId: '' } }) const { execSync } = require('child_process') const { GitProcess } = require('dugite') const { getCurrentBranch } = require('./lib/utils.js') const GitHub = require('github') const path = require('path') const github = new GitHub() const gitDir = path.resolve(__dirname, '..') github.authenticate({ type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN }) function getLastBumpCommit (tag) { const data = execSync(`git log -n1 --grep "Bump ${tag}" --format='format:{"hash": "%H", "message": "%s"}'`).toString() return JSON.parse(data) } async function revertBumpCommit (tag) { const branch = await getCurrentBranch() const commitToRevert = getLastBumpCommit(tag).hash await GitProcess.exec(['revert', commitToRevert], gitDir) const pushDetails = await GitProcess.exec(['push', 'origin', `HEAD:${branch}`, '--follow-tags'], gitDir) if (pushDetails.exitCode === 0) { console.log(`${pass} successfully reverted release commit.`) } else {
createRepo: function () { var done = this.async(); var github = new GitHubApi({ version: '3.0.0' }); github.authenticate({ type: 'basic', username: this.props.username, password: this.props.password }); // Create the repo github.repos.create({ name: this.props.name, description: this.props.description }, function (err, newRepo) { if (err) { // Repo already exists, probably? if (err.code === 422) { var res; try { res = JSON.parse(err.message); } catch (e) { this.log.error(err); this.log.error(e); } if (res.errors && res.errors[0] && res.errors[0].message === 'name already exists on this account') { this.log.error('Repo already exists'); this.prompt({ name: 'use', message: 'Use this repo anyway?', type: 'confirm', default: false }, function (p) { if (!p.use) { this.log.error('No longer setting up git repository'); return done(); } github.repos.get({ user: this.props.username, repo: this.props.name }, function (err, repo) { if (err) { this.log.error(err); } this.log.ok('Got the repo info'); this.props.githubRepo = repo || {}; done(); }.bind(this)); }.bind(this)); return; } } // Not sure when we would get this, just log this.log.error(err); return done(); } // Create was successful this.log.ok('Repository created!'); this.props.githubRepo = newRepo || {}; done(); }.bind(this)); },
user: "vincenthou@augmentum.com.cn", pass: "111111" } }); var github = new GitHubApi({ // required version: "3.0.0", // optional debug: true, protocol: "https", host: "api.github.com", timeout: 5000 }); github.authenticate({ type: "oauth", token: 'a3c65f5cb552a03f84360881281c6ad79fd68ae6' }); function getLatestSession(sessions) { return _.max(sessions, function(session){ return new Date(session.created_at).getTime(); }); } function sendNotificationMail(session) { // setup e-mail data with unicode symbols // //avatar_url var mailOptions = { from: "Frontnode <vincenthou@augmentum.com.cn>", // sender address to: officeEmails.join(','), // list of receivers
var token = process.env.GITHUB_API; var githubUser = process.env.USER; var githubRepo = process.env.REPO; var GitHubApi = require("github"); var github = new GitHubApi({ version: "3.0.0", }); var labelCount = 0; var issuesCount = 0; github.authenticate({ type: "oauth", token: token }); github.issues.repoIssues({ user: githubUser, repo: githubRepo, state: "open" }, function(err, res) { if (err) {console.log(JSON.stringify(err))}; updateIssues(res); console.log("Updated " + issuesCount + " issues"); }); function updateIssues(issues){
if (suiteUtil.isMocked && !suiteUtil.isRecording) { cmd.push('-s'); cmd.push(process.env.AZURE_SUBSCRIPTION_ID); } executeCommand(cmd, callback); }; var githubUsername = process.env['AZURE_GITHUB_USERNAME']; var githubPassword = process.env['AZURE_GITHUB_PASSWORD']; var githubRepositoryFullName = process.env['AZURE_GITHUB_REPOSITORY']; var githubClient = new GitHubApi({ version: '3.0.0' }); githubClient.authenticate({ type: 'basic', username: githubUsername, password: githubPassword }); describe('cli', function(){ describe('deployment', function() { before(function (done) { suiteUtil = new MockedTestUtils(testPrefix, true); suiteUtil.setupSuite(done); }); after(function (done) { suiteUtil.teardownSuite(done); }); beforeEach(function (done) {
gulp.task('github-release', function(cb) { const github = new GitHubAPI({ version: '3.0.0', protocol: 'https', timeout: 5000, headers: {'user-agent': 'Championify-Gulp-Release'} }); github.authenticate({type: 'oauth', token: process.env.GITHUB_TOKEN}); const createRelease = Promise.promisify(github.releases.createRelease); const uploadAsset = Promise.promisify(github.releases.uploadAsset); const changelog = fs.readFileSync('./CHANGELOG.md', 'utf8'); let body = changelog.split(/<a name="*.*.*" \/>/g)[1]; body += '\n\n## Virus Total Reports\n'; function formatTitle(name, link) { return `[${name} | VirusTotal Report](${link})\n`; } R.forEach(item => { if (item.indexOf('Windows_Setup') > -1) body += formatTitle('Windows Setup', GLOBAL.vtReports[item]); if (item.indexOf('.WIN.') > -1) body += formatTitle('Windows ZIP', GLOBAL.vtReports[item]); if (item.indexOf('OSX') > -1) body += formatTitle('Mac/OSX', GLOBAL.vtReports[item]); if (item.indexOf('asar') > -1) body += formatTitle('update.asar', GLOBAL.vtReports[item]); if (item.indexOf('u_osx') > -1) body += formatTitle('u_osx.tar.gz', GLOBAL.vtReports[item]); if (item.indexOf('u_win') > -1) body += formatTitle('u_win.tar.gz', GLOBAL.vtReports[item]); }, R.keys(GLOBAL.vtReports)); body += [ '', '## How to Download:', 'Below you\'ll find the download section. If you\'re on Windows, your best bet it to select the "Windows Setup" to get yourself started with Championify. If you have trouble installing you can always try the ".zip" version.', 'For Mac, download the file labeled "OSX", extract the .zip, and you\'ll be good to go!' ].join('\n'); const create_release = { owner: 'dustinblackman', repo: 'Championify', tag_name: pkg.version, draft: true, name: `Championify ${pkg.version}`, body }; return createRelease(create_release) .then(R.prop('id')) .then(id => { return Promise.resolve(glob.sync('./releases/*')) .each(file_path => { console.log(`[GITHUB] Uploading: ${file_path}`); const upload_file = { owner: 'dustinblackman', repo: 'Championify', id, name: path.basename(file_path), filePath: file_path }; return uploadAsset(upload_file); }); }); });
url = config.jenkins.protocol + "://" + config.jenkins.username + ':' + config.jenkins.password + '@' + config.jenkins.url; //jenkins = require('jenkins')(url) var GithubApi = require('github') var github = new GithubApi({ // required version: "3.0.0", // optional debug: true, protocol: "https", host: "api.github.com", timeout: 5000 }); github.authenticate({ type: "oauth", token: config.github.token }); github.pullRequests.getAll( {repo: config.github.repo, user: config.github.user, state: 'closed', page: 1, per_page: 5}, function(err, result){ if (err) throw err; _.forEach(result, function(r){ console.log('=================') console.log(r.head.label) console.log(r.head.sha) console.log(r.user.login) }) }) // jenkins.info(function(err, data) {
var async = require("async"); var secret = require("../config/secret"); var utils = require("./utils"); var GitHubApi = require("github"); // Extended this to add the stats I needed. (https://github.com/mikedeboer/node-github/pull/207) var Organization = require("../models/Organization"); // Instantiate API var github = new GitHubApi({ version: "3.0.0" }); // Authenticate with static token github.authenticate({ type: "oauth", token: secret.githubToken }); // // TEST // var options = {user: 'asdlkfjasdfdf'}; // utils.paginateAndPush(github.repos.getFromUser, options, function(err, repos) { // if (err) { // console.log('Error getting scraping all data: ',err); // } else { // console.log("Got all github data! Woo!"); // } // console.log("Shutting down..."); // }); /** * ======= STEP 1 ========
var auth = function() { if (!token) return; github.authenticate({type: 'oauth', token: token}); };
module.exports = (function () { logger.info('Initialize github API', module); var gitPublic, gitPrivate, commonConfig = { version: '3.0.0', debug: false, protocol: 'https', timeout: 50000 }, publicConfig = { host: 'api.github.com' }, privateConfig = { host: 'github.yandex-team.ru', url: '/api/v3' }, publicCredentials = config.get('credentials:public'), privateCredentials = config.get('credentials:private'); gitPublic = new Api(_.extend(publicConfig, commonConfig)); if (publicCredentials && publicCredentials.length) { gitPublic.authenticate({ type: 'oauth', token: publicCredentials }); }else { logger.warn('It would be better if you were input you public credential oauth token', module); } gitPrivate = new Api(_.extend(privateConfig, commonConfig)); if (privateCredentials && privateCredentials.length) { gitPrivate.authenticate({ type: 'oauth', token: privateCredentials }); } return { /** * Return information about github repository * @param {Object} source configuration object with fields: * - user {String} owner of repository * - name {String} name of repository * @returns {defer.promise|*} */ getRepository: function (source) { var def = vow.defer(), git = (source.isPrivate && source.isPrivate === 'true') ? gitPrivate : gitPublic; git.repos.get({ user: source.user, repo: source.name }, function (err, res) { if (err) { logger.error(err.message, module); def.reject(err); } def.resolve({ source: source, result: res }); }); return def.promise(); }, /** * Returns information about tags of github repository * @param {Object} source configuration object with fields: * - user {String} owner of repository * - name {String} name of repository * @returns {defer.promise|*} */ getRepositoryTags: function (source) { var def = vow.defer(), git = source.isPrivate ? gitPrivate : gitPublic, opts = { user: source.user, repo: source.name }; opts['per_page'] = 100; git.repos.getTags(opts, function (err, res) { if (err) { logger.error(err.message, module); def.reject(err); } def.resolve({ source: source, result: res }); }); return def.promise(); }, /** * Return information about branches of github repository * @param {Object} source configuration object with fields: * - user {String} owner of repository * - name {String} name of repository * @returns {defer.promise|*} */ getRepositoryBranches: function (source) { var def = vow.defer(), git = source.isPrivate ? gitPrivate : gitPublic, opts = { user: source.user, repo: source.name }; opts['per_page'] = 100; git.repos.getBranches(opts, function (err, res) { if (err) { logger.error(err.message, module); def.reject(err); } def.resolve({ source: source, result: res }); }); return def.promise(); }, /** * Returns content of repository directory or file loaded by github api * @param {Object} source configuration object with fields: * - user {String} name of user or organization which this repository is belong to * - repo {String} name of repository * - ref {String} name of branch * - path {String} relative path from the root of repository * @returns {*} */ getContent: function (source) { var def = vow.defer(), git = source.isPrivate ? gitPrivate : gitPublic; git.repos.getContent({ user: source.user, repo: source.repo, ref: source.ref, path: source.path }, function (err, res) { if (err || !res) { def.reject({ res: null, repo: source }); }else { def.resolve({ res: res, repo: source }); } }); return def.promise(); } }; })();