mirror of
https://code.forgejo.org/actions/git-backporting.git
synced 2025-05-17 11:09:13 -04:00
fix: auto-no-squash inference for GitLab (#140)
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:
parent
c3daf80306
commit
b4d0481c56
8 changed files with 257 additions and 8 deletions
|
@ -45,17 +45,17 @@ export const inferGitApiUrl = (prUrl: string, apiVersion = "v4"): string => {
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
export const inferSquash = (open: boolean, squash_commit: string | undefined): boolean => {
|
||||
export const inferSquash = (open: boolean, squash_commit: string | undefined | null): boolean => {
|
||||
const logger = LoggerServiceFactory.getLogger();
|
||||
|
||||
if (open) {
|
||||
logger.debug("cherry-pick all commits because they have not been merged (or squashed) in the base branch yet");
|
||||
return false;
|
||||
} else {
|
||||
if (squash_commit !== undefined) {
|
||||
if (squash_commit) {
|
||||
logger.debug(`cherry-pick the squashed commit ${squash_commit}`);
|
||||
return true;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue