github-cycle-time

Calculates Reaction/Lead/Cycle Time metrics from your GitHub issues.

View the Project on GitHub groundbreaker/github-cycle-time

@groundbreaker/github-cycle-time Build Status

Calculates Reaction/Lead/Cycle Time from your Organization’s GitHub issues.

Getting Started

Add as a dependency to your project:

yarn add @groundbreaker/github-cycle-time

or

npm install @groundbreaker/github-cycle-time

Usage

Creating an instance of CycleTime

const CycleTime = require('@groundbreaker/github-cycle-time');

// assuming you have stored your configuration in the environment...
service = new CycleTime({ org: process.env.GITHUB_ORG, token: process.env.GITHUB_TOKEN });

Options


API

CycleTime#tickets(since)

This provides access to all of the tickets in your organization, summarized with event timestamps, and cycle durations. Must be called with a ISO8601 timestamp string argument, which filters issues that were created on or after this date. This method returns a Promise, and must be used with then() or async/await.

Example

const CycleTime = require('@groundbreaker/github-cycle-time');
service = new CycleTime({ org: process.env.GITHUB_ORG, token: process.env.GITHUB_TOKEN });

service.tickets('2018-08-01T00:00:00Z')
.then((data) => {
  // do something with data
  console.log(data);
})
.catch((error) => {
  console.error(error);
});

Return Value

[
  {
    id: 1,
    opened: '1978-01-13T09:11:00Z',
    assigned: '1978-01-14T09:11:00Z',
    closed: '1978-01-16T09:11:00Z',
    reopened: '1978-01-15T09:11:00Z',
    reaction_time: 86400,
    cycle_time: 172800,
    lead_time: 259200
  }
]

CycleTime#metrics(since)

This provides an aggregation of the cycle durations for all the tickets in your organization returned by CycleTime#tickets(since). Must be called with a ISO8601 timestamp string argument, which filters issues that were created on or after this date. This method returns a Promise, and must be used with then() or async/await.

const CycleTime = require('@groundbreaker/github-cycle-time');
service = new CycleTime({ org: process.env.GITHUB_ORG, token: process.env.GITHUB_TOKEN });

service.metrics('2018-08-01T00:00:00Z')
.then((data) => {
  // do something with data
  console.log(data);
})
.catch((error) => {
  console.error(error);
});

Return Value

{
  org: 'groundbreaker',
  reaction_time_mean: 8,
  reaction_time_median: 8,
  reaction_time_mean_human: '0.1M',
  reaction_time_median_human: '0.1M',
  cycle_time_mean: 8024878,
  cycle_time_median: 8024878,
  cycle_time_mean_human: '13W 1D 21H 8.0M',
  cycle_time_median_human: '13W 1D 21H 8.0M',
  lead_time_mean: 8024886,
  lead_time_median: 8024886,
  lead_time_mean_human: '13W 1D 21H 8.1M',
  lead_time_median_human: '13W 1D 21H 8.1M'
}

Meta