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
- Add this package to your dependencies:
npm install --save fetch-github-app
- Use it like this:
const fetchGithubApp = require('fetch-github-app');
const config = {
appId: 1337,
appPrivateKey: '-----BEGIN RSA PRIVATE KEY----- ...',
installationId: 42,
userAgent: 'your-username-or-org-name'
};
fetchGithubApp(config).then(githubApp => {
console.log(githubApp.installationAccessToken);
return githubApp.fetch('installation/repositories').then(body => {
console.log(body.repositories);
});
});
Testing
To test the package on your machine:
npm install
- Create a
.env
file respecting the dotenv guidelines and add the environment variables mentioned by index.test.js
. npm test