[GitHub] Issue and pull request detail and check state (#1114)

This adds badges for Github issues and pull requests. You can display the state, title, username, number of comments, age, time since last update, and state of checks.

Provides an endpoint the Shields CI can use to fetch PR titles for #979 and resolves #1011.
This commit is contained in:
Paul Melnikow
2017-10-02 13:26:42 -04:00
committed by GitHub
parent 8e08b374a4
commit bb66a99a66
6 changed files with 246 additions and 10 deletions

19
lib/github-helpers.js Normal file
View File

@@ -0,0 +1,19 @@
'use strict';
const { colorScale } = require('./color-formatters');
function stateColor(s) {
return { open: '2cbe4e', closed: 'cb2431', merged: '6f42c1' }[s];
}
function checkStateColor(s) {
return { pending: 'dbab09', success: '2cbe4e', failure: 'cb2431', error: 'cb2431' }[s];
}
const commentsColor = colorScale([1, 3, 10, 25], undefined, true);
module.exports = {
stateColor,
checkStateColor,
commentsColor
};