Skip to content

Commit 7fc2f9d

Browse files
authored
fix(ncu-ci): fix missing await causing all CI requests to be rejected (#799)
1 parent 78ef163 commit 7fc2f9d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/ci/run_ci.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export class RunPRJob {
2626
this.prData = new PRData({ prid, owner, repo }, cli, request);
2727
this.certifySafe =
2828
certifySafe ||
29-
new PRChecker(cli, this.prData, request, {}).checkCommitsAfterReview();
29+
Promise.all([this.prData.getReviews(), this.prData.getPR()]).then(() =>
30+
new PRChecker(cli, this.prData, request, {}).checkCommitsAfterReview()
31+
);
3032
}
3133

3234
async getCrumb() {
@@ -68,7 +70,7 @@ export class RunPRJob {
6870
async start() {
6971
const { cli, certifySafe } = this;
7072

71-
if (!certifySafe) {
73+
if (!(await certifySafe)) {
7274
cli.error('Refusing to run CI on potentially unsafe PR');
7375
return false;
7476
}

test/unit/ci_start.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('Jenkins', () => {
124124
const cli = new TestCLI();
125125

126126
sinon.replace(PRChecker.prototype, 'checkCommitsAfterReview',
127-
sinon.fake.returns(certifySafe));
127+
sinon.fake.returns(Promise.resolve(certifySafe)));
128128

129129
const request = {
130130
gql: sinon.stub().returns({

0 commit comments

Comments
 (0)