Skip to content
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

Using target_branch for jira labels when isDeployBeforeMerge flag is true (#924) #960

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/common/ticketProvider/ticketProviderRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { SfError } from "@salesforce/core";
import c from "chalk";
import { Ticket } from "./index.js";
import { getCurrentGitBranch, uxLog } from "../utils/index.js";
import { GitProvider } from "../gitProvider/index.js";

export abstract class TicketProviderRoot {
public isActive = false;
Expand All @@ -25,9 +26,20 @@ export abstract class TicketProviderRoot {
public async getDeploymentTag(): Promise<string> {
const currentGitBranch = await getCurrentGitBranch() || "";
let tag = currentGitBranch.toUpperCase() + "_DEPLOYED";

if (GitProvider.isDeployBeforeMerge()) {
const prInfo = await GitProvider.getPullRequestInfo();
const targetBranch = prInfo?.targetBranch || process.env.FORCE_TARGET_BRANCH;
if (targetBranch) {
tag = targetBranch.toUpperCase() + "_DEPLOYED";
}
}

if (process.env?.DEPLOYED_TAG_TEMPLATE && !(process.env?.DEPLOYED_TAG_TEMPLATE || "").includes("$(")) {
tag = process.env?.DEPLOYED_TAG_TEMPLATE.replace("{BRANCH}", currentGitBranch.toUpperCase());
const branchToUse = tag.replace("_DEPLOYED", "");
nvuillam marked this conversation as resolved.
Show resolved Hide resolved
tag = process.env?.DEPLOYED_TAG_TEMPLATE.replace("{BRANCH}", branchToUse);
}

return tag;
}
}
Loading