fix: auto-no-squash inference for GitLab (#140)
Some checks failed
main ci / ubuntu-latest - node 16 (push) Has been cancelled
main ci / ubuntu-latest - node 18 (push) Has been cancelled
main ci / ubuntu-latest - node 20 (push) Has been cancelled

When a GitLab MR is not squashed, `squash_commit_sha` will be `null`,
not `undefined`. Update `inferSquash()` to account for this.
This commit is contained in:
Ratchanan Srirattanamet 2024-10-07 19:40:31 +07:00 committed by GitHub
parent c3daf80306
commit b4d0481c56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 257 additions and 8 deletions

4
dist/cli/index.js vendored
View file

@ -733,7 +733,7 @@ exports.inferGitApiUrl = inferGitApiUrl;
/**
* Infer the value of the squash option
* @param open true if the pull/merge request is still open
* @param squash_commit undefined if the pull/merge request was merged, the sha of the squashed commit if it was squashed
* @param squash_commit undefined or null if the pull/merge request was merged, the sha of the squashed commit if it was squashed
* @returns true if a single commit must be cherry-picked, false if all merged commits must be cherry-picked
*/
const inferSquash = (open, squash_commit) => {
@ -743,7 +743,7 @@ const inferSquash = (open, squash_commit) => {
return false;
}
else {
if (squash_commit !== undefined) {
if (squash_commit) {
logger.debug(`cherry-pick the squashed commit ${squash_commit}`);
return true;
}