diff --git a/lib/pr_checker.js b/lib/pr_checker.js index 754a89c2..ca635511 100644 --- a/lib/pr_checker.js +++ b/lib/pr_checker.js @@ -537,7 +537,10 @@ export default class PRChecker { const requestCiLabels = data.labeledEvents.findLast( ({ createdAt, label: { name } }) => name === 'request-ci' && createdAt > updatedAt ); - if (requestCiLabels == null) return false; + if (requestCiLabels == null) { + cli.warn('Something was pushed to the Pull Request branch since the last request-ci label.'); + return false; + } const { actor: { login } } = requestCiLabels; const collaborators = Array.from(data.collaborators.values(), diff --git a/test/unit/pr_checker.test.js b/test/unit/pr_checker.test.js index e71837f7..b9c41264 100644 --- a/test/unit/pr_checker.test.js +++ b/test/unit/pr_checker.test.js @@ -2120,6 +2120,15 @@ describe('PRChecker', () => { }); it('should return false if PR has outdated request-ci from a collaborator', async() => { + const expectedLogs = { + warn: [ + ['No approving reviews found'], + ['Something was pushed to the Pull Request branch since the last request-ci label.'] + ], + info: [], + error: [] + }; + const cli = new TestCLI(); data.getLabeledEvents = async() => { data.labeledEvents = labeledEvents['old-request-ci-collaborator']; @@ -2128,6 +2137,7 @@ describe('PRChecker', () => { const status = await checker.checkCommitsAfterReviewOrLabel(); assert.strictEqual(status, false); + cli.assertCalledWith(expectedLogs); }); it('should return true if PR has recent request-ci from a collaborator', async() => { @@ -2247,7 +2257,7 @@ describe('PRChecker', () => { cli.assertCalledWith(expectedLogs); }); - it('should return true if PR can be landed', () => { + it('should return false if PR was updated after approvals', () => { const expectedLogs = { warn: [ ['Something was pushed to the Pull Request branch since the last approving review.']