Skip to content

fix(ncu-ci): fix missing await causing all CI requests to be rejected #799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/ci/run_ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export class RunPRJob {
this.prData = new PRData({ prid, owner, repo }, cli, request);
this.certifySafe =
certifySafe ||
new PRChecker(cli, this.prData, request, {}).checkCommitsAfterReview();
Promise.all([this.prData.getReviews(), this.prData.getPR()]).then(() =>
new PRChecker(cli, this.prData, request, {}).checkCommitsAfterReview()
);
}

async getCrumb() {
Expand Down Expand Up @@ -68,7 +70,7 @@ export class RunPRJob {
async start() {
const { cli, certifySafe } = this;

if (!certifySafe) {
if (!(await certifySafe)) {
cli.error('Refusing to run CI on potentially unsafe PR');
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ci_start.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('Jenkins', () => {
const cli = new TestCLI();

sinon.replace(PRChecker.prototype, 'checkCommitsAfterReview',
sinon.fake.returns(certifySafe));
sinon.fake.returns(Promise.resolve(certifySafe)));

const request = {
gql: sinon.stub().returns({
Expand Down