Show PR action when auto-merge is enabled
This commit is contained in:
@@ -342,6 +342,9 @@ function getPrimaryActionId(input: BuildGitActionsInput): GitActionId | null {
|
||||
if (canEnablePrAutoMerge(input)) {
|
||||
return getDefaultEnablePullRequestAutoMergeActionId(input);
|
||||
}
|
||||
if (hasEnabledPrAutoMerge(input)) {
|
||||
return "pr";
|
||||
}
|
||||
if (!input.isOnBaseBranch && input.aheadCount > 0) {
|
||||
return "merge-branch";
|
||||
}
|
||||
@@ -554,6 +557,16 @@ function canEnablePrAutoMerge(input: BuildGitActionsInput): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
function hasEnabledPrAutoMerge(input: BuildGitActionsInput): boolean {
|
||||
return (
|
||||
input.githubFeaturesEnabled &&
|
||||
input.hasPullRequest &&
|
||||
input.pullRequestUrl !== null &&
|
||||
hasPullRequestGithubFacts(input.pullRequestGithub) &&
|
||||
input.pullRequestGithub.autoMergeRequest !== null
|
||||
);
|
||||
}
|
||||
|
||||
function getPullUnavailableMessage(input: BuildGitActionsInput): string | undefined {
|
||||
if (!input.hasRemote) {
|
||||
return "Pull isn't available here because this branch is not connected to a remote yet";
|
||||
|
||||
Reference in New Issue
Block a user