github-app

4.0.1 • Public • Published

GitHub Apps

NodeJS module for building GitHub Apps.

Installation

npm install --save github-app

Usage

const createApp = require('github-app');
 
const app = createApp({
  // Your app id
  id: 987,
  // The private key for your app, which can be downloaded from the
  // app's settings: https://github.com/settings/apps
  cert: require('fs').readFileSync('private-key.pem')
});

asInstallation

Authenticate as an installation, returning a github API client, which can be used to call any of the APIs supported by GitHub Apps:

//Modify value according to getInstallations return(example in asApp section)
var installationId = 99999;
 
app.asInstallation(installationId).then(github => {
  github.issues.createComment({
    owner: 'foo',
    repo: 'bar',
    number: 999,
    body: 'hello world!'
  });
});

asApp

Authenticate as an app, also returning an instance of the GitHub API client.

app.asApp().then(github => {
  console.log("Installations:")
  github.apps.getInstallations({}).then(console.log);
});

Readme

Keywords

none

Package Sidebar

Install

npm i github-app

Weekly Downloads

122

Version

4.0.1

License

ISC

Unpacked Size

4.99 kB

Total Files

5

Last publish

Collaborators

  • bkeepers