-
Notifications
You must be signed in to change notification settings - Fork 12
If branch not sent, take default branch #163
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
Conversation
33d1dc3 to
3b261f3
Compare
src/builds/builds.controller.ts
Outdated
| const build = await this.buildsService.findOrCreate({ | ||
| projectId: project.id, | ||
| branchName: createBuildDto.branchName, | ||
| branchName: (createBuildDto.branchName && createBuildDto.branchName.trim().length > 0) ? createBuildDto.branchName : project.mainBranchName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty branch name should be validated in another place if needed
| branchName: (createBuildDto.branchName && createBuildDto.branchName.trim().length > 0) ? createBuildDto.branchName : project.mainBranchName, | |
| branchName: createBuildDto.branchName ?? project.mainBranchName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, cover this with e2e test https://github.com/Visual-Regression-Tracker/backend/blob/master/test/builds.e2e-spec.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Added. I also made branchName optional in the DTO just like ciBuildId.
Co-authored-by: Pavel Strunkin <pashidlos@gmail.com>
pashidlos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This will enable SDK and clients not to send branch information. That way, it will use the default branch if not provided.