Skip to content

Commit

Permalink
add warn msg for fast-track Pull Requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
priyank-p committed Nov 11, 2017
1 parent 2899719 commit c45d459
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 10 additions & 1 deletion lib/pr_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,17 @@ class PRChecker {
const { pr } = this;
const { cli } = this;
const labels = pr.labels.nodes;

let isFastTrack = false;
const fast = labels.some((l) => isFast(l.name)) ||
(labels.length === 1 && labels[0].name === 'doc');

if (isFastTrack) {
cli.info('This PR is being fast-tracked.');
}

if (fast) { return true; }

const wait = this.getWait(now);
if (wait.timeLeft > 0) {
const dateStr = new Date(pr.createdAt).toDateString();
Expand All @@ -165,7 +173,8 @@ class PRChecker {
}

function isFast(label) {
return (label === 'code-and-learn' || label === 'fast-track');
isFastTrack = label === 'fast-track';
return (label === 'code-and-learn' || isFastTrack);
}

return true;
Expand Down
7 changes: 4 additions & 3 deletions test/unit/pr_checker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,10 @@ describe('PRChecker', () => {
it('should skip wait check for fast-track labelled PR', () => {
const cli = new TestCLI();

const expectedLogs = {};
const expectedLogs = {
info: [['This PR is being fast-tracked.']]
};

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

const status = checker.checkPRWait(now);
const status = checker.checkPRWait(new Date());
assert(status);
cli.assertCalledWith(expectedLogs);
});
Expand Down

0 comments on commit c45d459

Please sign in to comment.