Skip to content

Commit 3ae6ae3

Browse files
committed
PRChecker: support new label fast-track
1 parent d589e35 commit 3ae6ae3

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

lib/pr_checker.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class PRChecker {
152152
const { pr } = this;
153153
const { cli } = this;
154154
const labels = pr.labels.nodes;
155-
const fast = labels.some((l) => l.name === 'code-and-learn') ||
155+
const fast = labels.some((l) => isFast(l.name)) ||
156156
(labels.length === 1 && labels[0].name === 'doc');
157157
if (fast) { return true; }
158158
const wait = this.getWait(now);
@@ -164,6 +164,10 @@ class PRChecker {
164164
return false;
165165
}
166166

167+
function isFast(label) {
168+
return (label === 'code-and-learn' || label === 'fast-track');
169+
}
170+
167171
return true;
168172
}
169173

test/unit/pr_checker.test.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,35 @@ describe('PRChecker', () => {
224224
assert(status);
225225
cli.assertCalledWith(expectedLogs);
226226
});
227+
228+
it('should skip wait check for fast-track labelled PR', () => {
229+
const cli = new TestCLI();
230+
231+
const expectedLogs = {};
232+
233+
const now = new Date();
234+
const youngPR = Object.assign({}, firstTimerPR, {
235+
createdAt: '2017-10-27T14:25:41.682Z',
236+
labels: {
237+
nodes: [
238+
{ name: 'fast-track' }
239+
]
240+
}
241+
});
242+
243+
const checker = new PRChecker(cli, {
244+
pr: youngPR,
245+
reviewers: allGreenReviewers,
246+
comments: commentsWithLGTM,
247+
reviews: approvingReviews,
248+
commits: simpleCommits,
249+
collaborators
250+
});
251+
252+
const status = checker.checkPRWait(now);
253+
assert(status);
254+
cli.assertCalledWith(expectedLogs);
255+
});
227256
});
228257

229258
describe('checkCI', () => {

0 commit comments

Comments
 (0)