Skip to content

Commit c45d459

Browse files
committed
add warn msg for fast-track Pull Requests.
1 parent 2899719 commit c45d459

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

lib/pr_checker.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,17 @@ class PRChecker {
152152
const { pr } = this;
153153
const { cli } = this;
154154
const labels = pr.labels.nodes;
155+
156+
let isFastTrack = false;
155157
const fast = labels.some((l) => isFast(l.name)) ||
156158
(labels.length === 1 && labels[0].name === 'doc');
159+
160+
if (isFastTrack) {
161+
cli.info('This PR is being fast-tracked.');
162+
}
163+
157164
if (fast) { return true; }
165+
158166
const wait = this.getWait(now);
159167
if (wait.timeLeft > 0) {
160168
const dateStr = new Date(pr.createdAt).toDateString();
@@ -165,7 +173,8 @@ class PRChecker {
165173
}
166174

167175
function isFast(label) {
168-
return (label === 'code-and-learn' || label === 'fast-track');
176+
isFastTrack = label === 'fast-track';
177+
return (label === 'code-and-learn' || isFastTrack);
169178
}
170179

171180
return true;

test/unit/pr_checker.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,10 @@ describe('PRChecker', () => {
227227
it('should skip wait check for fast-track labelled PR', () => {
228228
const cli = new TestCLI();
229229

230-
const expectedLogs = {};
230+
const expectedLogs = {
231+
info: [['This PR is being fast-tracked.']]
232+
};
231233

232-
const now = new Date();
233234
const youngPR = Object.assign({}, firstTimerPR, {
234235
createdAt: '2017-10-27T14:25:41.682Z',
235236
labels: {
@@ -248,7 +249,7 @@ describe('PRChecker', () => {
248249
collaborators
249250
});
250251

251-
const status = checker.checkPRWait(now);
252+
const status = checker.checkPRWait(new Date());
252253
assert(status);
253254
cli.assertCalledWith(expectedLogs);
254255
});

0 commit comments

Comments
 (0)