Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

feat: add an SLO for PRs #161

Merged
merged 1 commit into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
"description": "Required feature/issue must be fixed prior to next release.",
"color": "ffa03e"
},
{
"name": "needs work",
"description": "This is a pull request that needs a little love.",
"color": "1a3b70"
},
{
"name": "type: docs",
"description": "Improvement to the documentation for an API.",
Expand Down Expand Up @@ -123,12 +128,12 @@
{
"name": "help wanted",
"description": "We'd love to have community involvement on this issue.",
"color": "FFFFFF"
"color": "3f5e3d"
},
{
"name": "good first issue",
"description": "This issue is a good place to started contributing to this repository.",
"color": "FFFFFF"
"color": "520b77"
}
]
}
2 changes: 1 addition & 1 deletion src/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {Flags, Issue, IssueResult, Repo} from './types';
import {octo, repos} from './util';

import Table = require('cli-table');
import {isTriaged, isOutOfSLO, hasLabel, isApi, isPullRequest, hoursOld, getApi} from './slo';
import {isTriaged, isOutOfSLO, hasLabel, isPullRequest, hoursOld, getApi} from './slo';
const truncate = require('truncate');
const CSV = require('csv-string');

Expand Down
9 changes: 8 additions & 1 deletion src/slo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,15 @@ export function hoursOld(date: string) {
* @param i Issue to analyze
*/
export function isOutOfSLO(i: Issue) {
// Pull requests don't count.
// Pull requests must be merged within a week, unless they have a
// 'needs work' label. After 90 days, it should just be resolved.
if (isPullRequest(i)) {
if (daysOld(i.created_at) > 90) {
return true;
}
if (daysOld(i.created_at) > 7 && !hasLabel(i, 'needs work')) {
return true;
}
return false;
}

Expand Down