Collect statistical information about issues of a GitHub repository
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.editorconfig
.eslintrc.json
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

gh-issues-stats

NPM version Downloads Build Status Coverage Status Dependency status Dev Dependency status Greenkeeper badge

Collect statistical information about issues of a GitHub repository.

Installation

$ npm install gh-issues-stats

Usage

const ghIssueStats = require('gh-issues-stats');

ghIssueStats('IndigoUnited/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 to https://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 to null.
  • concurrency: The concurrency in which pages are requested, defaults to 5.
  • 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-cov to get coverage report

License

Released under the MIT License.