gh-issues-stats
v3.0.1
Published
Collect statistical information about issues of a GitHub repository
Downloads
49
Maintainers
Readme
gh-issues-stats
Collect statistical information about issues of a GitHub repository.
Installation
$ npm install gh-issues-stats
Usage
const ghIssueStats = require('gh-issues-stats');
ghIssueStats('moxystudio/node-cross-spawn')
.then((stats) => {
// `stats` looks like:
// {
// issues: {
// count: 32,
// openCount: 2,
// distribution: {
// 3600: 4, // 1 hour
// 10800: 20, // 3 hours.. and so on
// 32400: 6,
// 97200: 2,
// 291600: 0,
// 874800: 0,
// 2624400: 0,
// 7873200: 0,
// 23619600: 0,
// 70858800: 0,
// 212576400: 0,
// },
// },
// pullRequests: {
// .. same as above but for pull requests
// },
// }
}, (err) => {
console.log('Failed to fetch issue stats', err);
});
Available options:
apiUrl
: GitHub API URL, defaults tohttps://api.github.com
(you may change to point to a GitHub enterprise instance).tokens
: Array of API tokens to be used by token-dealer, defaults tonull
.concurrency
: The concurrency in which pages are requested, defaults to5
.got
Custom options to be passed to got, defaults to{ timeout: 15000, headers: { accept: 'application/vnd.github.v3+json' } }
tokenDealer
: Custom options to be passed to token-dealer, defaults to{ group: 'github' }
Tests
$ npm test
$ npm test -- --watch # during development
License
Released under the MIT License.