Skip to content

Commit

Permalink
ci: use full path to amplify cli
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Oct 25, 2023
1 parent 8e9cda0 commit b152483
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/amplify-codegen-e2e-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ declare global {
const amplifyTestsDir = 'amplify-codegen-e2e-tests';

export function getCLIPath(testingWithLatestCodebase = false) {
let commandName = 'amplify-dev';
if (isCI() && !testingWithLatestCodebase) {
return 'amplify';
commandName = 'amplify';
}
return 'amplify-dev';

return execSync(`which ${commandName}`)
.toString()
.trim();
}

export function isCI(): boolean {
return process.env.CI && (process.env.CODEBUILD) ? true : false;
return process.env.CI && process.env.CODEBUILD ? true : false;
}

export function injectSessionToken(profileName: string) {
Expand All @@ -57,7 +61,9 @@ export async function createNewProjectDir(
projectName: string,
prefix = path.join(fs.realpathSync(os.tmpdir()), amplifyTestsDir),
): Promise<string> {
const currentHash = execSync('git rev-parse --short HEAD', { cwd: __dirname }).toString().trim();
const currentHash = execSync('git rev-parse --short HEAD', { cwd: __dirname })
.toString()
.trim();
let projectDir;
do {
const randomId = await global.getRandomId();
Expand Down

0 comments on commit b152483

Please sign in to comment.