Skip to content

Commit 80f64b8

Browse files
committed
add warn msg for fast-track Pull Requests.
1 parent 3ae6ae3 commit 80f64b8

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

lib/pr_checker.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,15 @@ class PRChecker {
152152
const { pr } = this;
153153
const { cli } = this;
154154
const labels = pr.labels.nodes;
155-
const fast = labels.some((l) => isFast(l.name)) ||
155+
156+
const fast =
157+
labels.some((l) => ['code-and-learn', 'fast-track'].includes(l.name)) ||
156158
(labels.length === 1 && labels[0].name === 'doc');
157-
if (fast) { return true; }
159+
if (fast) {
160+
cli.info('This PR is being fast-tracked.');
161+
return true;
162+
}
163+
158164
const wait = this.getWait(now);
159165
if (wait.timeLeft > 0) {
160166
const dateStr = new Date(pr.createdAt).toDateString();
@@ -164,10 +170,6 @@ class PRChecker {
164170
return false;
165171
}
166172

167-
function isFast(label) {
168-
return (label === 'code-and-learn' || label === 'fast-track');
169-
}
170-
171173
return true;
172174
}
173175

test/unit/pr_checker.test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ describe('PRChecker', () => {
197197
it('should skip wait check for Code & Learn PR', () => {
198198
const cli = new TestCLI();
199199

200-
const expectedLogs = {};
200+
const expectedLogs = {
201+
info: [['This PR is being fast-tracked.']]
202+
};
201203

202204
const now = new Date();
203205
const youngPR = Object.assign({}, firstTimerPR, {
@@ -228,9 +230,10 @@ describe('PRChecker', () => {
228230
it('should skip wait check for fast-track labelled PR', () => {
229231
const cli = new TestCLI();
230232

231-
const expectedLogs = {};
233+
const expectedLogs = {
234+
info: [['This PR is being fast-tracked.']]
235+
};
232236

233-
const now = new Date();
234237
const youngPR = Object.assign({}, firstTimerPR, {
235238
createdAt: '2017-10-27T14:25:41.682Z',
236239
labels: {
@@ -249,7 +252,7 @@ describe('PRChecker', () => {
249252
collaborators
250253
});
251254

252-
const status = checker.checkPRWait(now);
255+
const status = checker.checkPRWait(new Date());
253256
assert(status);
254257
cli.assertCalledWith(expectedLogs);
255258
});

0 commit comments

Comments
 (0)