diff --git a/scripts/release/createNativeModules.js b/scripts/release/createNativeModules.js index 8d8d58e66..5db5714cc 100644 --- a/scripts/release/createNativeModules.js +++ b/scripts/release/createNativeModules.js @@ -138,7 +138,7 @@ async function updateNativeComponentsTestProject(moduleInfo, tmpFolder, nativeWi const tmpFolderActions = join(tmpFolder, `javascriptsource/${moduleInfo.moduleFolderNameInModeler}/actions`); console.log("Updating NativeComponentsTestProject..."); - await cloneRepo(moduleInfo.testProjectUrl, tmpFolder); + await cloneRepo(moduleInfo.testProjectUrl, tmpFolder, moduleInfo.testProjectBranchName); console.log("Deleting existing JS Actions from test project..."); await rm(tmpFolderActions, { force: true, recursive: true }); // this is useful to avoid retaining stale dependencies in the test project. @@ -208,7 +208,7 @@ async function updateNativeComponentsTestProjectWithAtlas(moduleInfo, tmpFolder) const tmpFolderNativeStyles = join(tmpFolder, `themesource/${moduleInfo.moduleFolderNameInModeler}`); console.log("Updating NativeComponentsTestProject.."); - await cloneRepo(moduleInfo.testProjectUrl, tmpFolder); + await cloneRepo(moduleInfo.testProjectUrl, tmpFolder, moduleInfo.testProjectBranchName); console.log("Copying Native styling files.."); await Promise.all([ diff --git a/scripts/release/module-automation/commons.d.ts b/scripts/release/module-automation/commons.d.ts index c7df0b02e..e63376ea1 100644 --- a/scripts/release/module-automation/commons.d.ts +++ b/scripts/release/module-automation/commons.d.ts @@ -8,7 +8,7 @@ export function getFiles(folder: string, extensions?: string[]): Promise; -export function cloneRepo(githubUrl: string, localFolder: string, branchName?: string): Promise; +export function cloneRepo(githubUrl: string, localFolder: string, branchName: string): Promise; export function createMPK(tmpFolder: string, moduleInfo: any, excludeFilesRegExp: RegExp): Promise; diff --git a/scripts/release/module-automation/commons.js b/scripts/release/module-automation/commons.js index 717dde883..67762893f 100644 --- a/scripts/release/module-automation/commons.js +++ b/scripts/release/module-automation/commons.js @@ -207,12 +207,13 @@ async function githubAuthentication(moduleInfo) { await execShellCommand(`echo "${process.env.GH_PAT}" | gh auth login --with-token`); } -async function cloneRepo(githubUrl, localFolder) { +async function cloneRepo(githubUrl, localFolder, branchName) { const githubUrlDomain = githubUrl.replace("https://", ""); const githubUrlAuthenticated = `https://${process.env.GH_USERNAME}:${process.env.GH_PAT}@${githubUrlDomain}`; await rm(localFolder, { recursive: true, force: true }); await mkdir(localFolder, { recursive: true }); - await execShellCommand(`git clone ${githubUrlAuthenticated} ${localFolder}`); + const branchOption = branchName ? `-b ${branchName}` : ""; + await execShellCommand(`git clone ${branchOption} ${githubUrlAuthenticated} ${localFolder}`); await setLocalGitCredentials(localFolder); }