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.
20 lines
428 B
JavaScript
20 lines
428 B
JavaScript
'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
|
|
};
|