Skip to content

Commit

Permalink
Use first diff version if there's no collected diff ver (#155)
Browse files Browse the repository at this point in the history
Co-authored-by: pdujtipiya <[email protected]>
  • Loading branch information
encX and pdujtipiya authored Oct 16, 2023
1 parent fbfd9d9 commit ccb5cd6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Provider/GitLab/GitLabMRService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as Resources from '@gitbeaker/core';
import { Gitlab } from '@gitbeaker/rest';

import { configs } from '../../Config';
import { Log } from '../../Logger';

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

if (collected.length === 0) throw new Error('No collected version in MR');
if (collected.length === 0) {
Log.warn(
'No collected version in this MR, will use SHA from the latest commit instead.',
);
return versions[0];
}

return collected[0];
}
Expand Down

0 comments on commit ccb5cd6

Please sign in to comment.