How to use github-api - 10 common examples

To help you get started, we’ve selected a few github-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cassioscabral / rateissuesfront / src / components / GithubIssuePreview / GithubIssuePreview.js View on Github external
componentWillMount () {
    const gh = new GitHub()
    this.getGithubRequestLimit(gh)
    let {username, repository, issueNumber} = this.getInfoFromURL(this.props.url)

    gh
    .getIssues(username, repository)
    .getIssue(issueNumber)
    .then((response) => {
      console.log('issue 1 response', response) // response data have the issue
      this.setState({issue: response.data})
    })
  }
  showIssueText () {
github Wiredcraft / jekyllpro-cms / api / server / webhook.js View on Github external
RepoAccessToken.findOne({ repository: repository.full_name }, (err, atk) => {
    if (err) {
      console.log(err);
    }

    let github = new GithubAPI({
      token: atk.accessToken
    });
    let repoObject = github.getRepo(repository.owner.name, repository.name);

    if (strategy.rebuild) {
      // rebuild
      return getFreshIndexFromGithub({
        repoObject,
        repoFullname: repository.full_name,
        branch
      }).then(saveIndexToDb(repository.full_name, branch));
    } else {
      // partial update
      RepoIndex.findByRepoInfo(repository.full_name, branch, (err, record) => {
        if (err) {
          console.log(err);
github vuejs / vue-curated-server / src / providers / github.js View on Github external
throw new Error('Please provide a GitHub API token with the `GITHUB_TOKEN` env var.')
}

// Source repo
const repoRaw = process.env.SOURCE_REPO
if (!repoRaw) {
  throw new Error('Please provide the source repo where the packages are listed with the `SOURCE_REPO` env var, e.g. SOURCE_REPO=vuejs/vue-curated')
}
const repoStrings = repoRaw.split('/')
if (repoStrings.length !== 2) {
  throw new Error('The `SOURCE_REPO` value must be of the form /, e.g. SOURCE_REPO=vuejs/vue-curated')
}
const OWNER = repoStrings[0]
const REPO = repoStrings[1]

const gh = new GitHub({
  token: TOKEN,
})

// Fields parsed from the md file
const moduleFields = [
  { key: 'vue', array: true },
  { key: 'links', array: true, map: parseMarkdownLink },
  { key: 'status' },
  { key: 'badge' },
]

// GitHub repo containing the packages list
let sourceRepo = gh.getRepo(OWNER, REPO)

function generateCategoryId (label) {
  return label.trim().toLowerCase().replace(/\s+/g, '_').replace(/\W/g, '')
github arminhammer / bellerophon / src / renderer / App.vue View on Github external
const _checkRelease = async function() {
  const gh = new GitHub();
  const repo = gh.getRepo('arminhammer', 'bellerophon');
  console.log('repo:');
  console.log(repo);
  const releaseList = await repo.listReleases();
  console.log(Array.isArray(releaseList.data));
  const latest_release = releaseList.data
    .filter(r => r.draft === false && r.prerelease === false)
    .sort((a, b) => semver.lt(a.tag_name, b.tag_name))[0].tag_name;
  console.log(latest_release);
  console.log(version);
  const newer = semver.gt(latest_release, version);
  console.log(newer);
  if (newer) {
    notifier.notify(`Version ${latest_release} of bellerophon is available!`);
  } else {
    notifier.notify('On newest version');
github pizn / eevee / src / services / user.js View on Github external
init() {
    const _leafAdmin = storage.get('_leafAdmin');
    const github = new Github({
      username: _leafAdmin.email,
      password: _leafAdmin.pass,
      auth: 'basic',
    });
    this.github = github;
  },
github pizn / eevee / src / services / repo.js View on Github external
init() {
    const _leafAdmin = storage.get('_leafAdmin');
    const github = new Github({
      username: _leafAdmin.email,
      password: _leafAdmin.pass,
      auth: 'basic',
    });
    this.github = github;
  },
github lowsky / dashboard / server / rest-graphql-proxy / apis / github.js View on Github external
import Github from 'github-api';

const { GITHUB_TOKEN } = process.env;

const github = new Github({
    token: GITHUB_TOKEN,
    auth: 'oauth',
});

export let getUser = username => {
    let user = github.getUser();
    return new Promise((resolve, reject) => {
        user.show(username, (err, user) => {
            if (user) {
                resolve(user);
            } else {
                reject(err);
            }
        });
    });
};
github clayallsopp / graphqlhub / graphqlhub-schemas / src / apis / github.js View on Github external
import Github from 'github-api';

var github = new Github({
  token : process.env.GITHUB_TOKEN,
  auth: 'oauth',
});

export let getUser = (username) => {
  let user = github.getUser();
  return new Promise((resolve, reject) => {
    user.show(username, (err, user) => {
      if (user) {
        resolve(user);
      }
      else {
        reject(err);
      }
    });
  });
github cassioscabral / rateissuesfront / src / components / organisms / main / Main.js View on Github external
requestGithub() {
    let github = new Github({})
    let search = github.getSearch(this.state.githubQuery.getQuery())

    search.issues(null, (err, issues) => {
      this.setState({
        issues: issues.items
      })
    })
  }
  currentComponentClass(component) {
github tidepool-org / blip / app / components / uploadlaunchoverlay / uploadlaunchoverlay.js View on Github external
*
 * You should have received a copy of the License along with this program; if
 * not, you can obtain one from Tidepool Project at tidepool.org.
 */

import _ from 'lodash';
import React, { Component } from 'react';
import { translate, Trans } from 'react-i18next';
import cx from 'classnames';
import GitHub from 'github-api';
import ModalOverlay from '../modaloverlay';
import utils from '../../core/utils';
import { URL_UPLOADER_DOWNLOAD_PAGE } from '../../core/constants';
import logoSrc from '../uploaderbutton/images/T-logo-dark-512x512.png';

const github = new GitHub();

const UploadLaunchOverlay = translate()(class UploadLaunchOverlay extends Component {
  constructor(props) {
    super(props);
    this.state = {
      latestWinRelease: null,
      latestMacRelease: null,
      error: null,
    };
  }

  static propTypes = {
    modalDismissHandler: React.PropTypes.func.isRequired,
  };

  componentWillMount = () => {

github-api

A higher-level wrapper around the Github API.

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis

Popular github-api functions