Socket
Socket
Sign inDemoInstall

fetch-github-app

Package Overview
Dependencies
7
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fetch-github-app

Node.js wrapper around Fetch to query the GitHub API as a GitHub App


Version published
Weekly downloads
15
decreased by-28.57%
Maintainers
3
Install size
535 kB
Created
Weekly downloads
 

Readme

Source

npm version build status

Goal

This package is made to simplify calls to the GitHub API as a GitHub App. It authenticates as a GitHub App and then gives you a wrapper around Fetch so that you can interact with the GitHub API easily.

Usage

  1. Add this package to your dependencies: npm install --save fetch-github-app
  2. Use it like this:
const fetchGithubApp = require('fetch-github-app');

const config = {
  // Can be found in the "GitHub Apps" section of your developer or organization settings.
  appId: 1337,
  // See https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/registering-github-apps/#generating-a-private-key.
  appPrivateKey: '-----BEGIN RSA PRIVATE KEY----- ...',
  // Can be found in the "Installed GitHub Apps" section of your developer or organization settings,
  // or in the payload of WebHook requests sent by GitHub to your App.
  installationId: 42,
  // See https://developer.github.com/v3/#user-agent-required.
  userAgent: 'your-username-or-org-name'
 };

fetchGithubApp(config).then(githubApp => {
 // You can retrieve the installation access token if you need to use it directly.
 console.log(githubApp.installationAccessToken);

 // And you can call the GitHub API (notice that you do not have to prefix your paths by https://api.github.com/).
 return githubApp.fetch('installation/repositories').then(body => {
   console.log(body.repositories);
 });
});

Testing

To test the package on your machine:

  1. npm install
  2. Create a .env file respecting the dotenv guidelines and add the environment variables mentioned by index.test.js.
  3. npm test

Keywords

FAQs

Last updated on 21 Aug 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc