Skip to content

Commit ccb5cd6

Browse files
encXpdujtipiya
and
pdujtipiya
authored
Use first diff version if there's no collected diff ver (#155)
Co-authored-by: pdujtipiya <[email protected]>
1 parent fbfd9d9 commit ccb5cd6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Provider/GitLab/GitLabMRService.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as Resources from '@gitbeaker/core';
1010
import { Gitlab } from '@gitbeaker/rest';
1111

1212
import { configs } from '../../Config';
13+
import { Log } from '../../Logger';
1314

1415
export class GitLabMRService implements IGitLabMRService {
1516
private readonly projectId: number;
@@ -86,7 +87,12 @@ export class GitLabMRService implements IGitLabMRService {
8687
);
8788
const collected = versions.filter((v) => v.state === 'collected');
8889

89-
if (collected.length === 0) throw new Error('No collected version in MR');
90+
if (collected.length === 0) {
91+
Log.warn(
92+
'No collected version in this MR, will use SHA from the latest commit instead.',
93+
);
94+
return versions[0];
95+
}
9096

9197
return collected[0];
9298
}

0 commit comments

Comments
 (0)