Skip to content

Commit

Permalink
Put the command in the if statement in order to handle the not found …
Browse files Browse the repository at this point in the history
…case.
  • Loading branch information
wrandall22 committed Apr 26, 2024
1 parent 60dddf8 commit 97414c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ case $AMPLIFY_COMMAND in

deploy)
echo "deploying"
branch_exists=$(sh -c "aws amplify get-branch --app-id=${AmplifyAppId} --branch-name=$BRANCH_NAME --region=${AWS_REGION}")

if [[ -z "$branch_exists" ]]; then
echo "branch_exists is empty"
if [[ $(sh -c "aws amplify get-branch --app-id=${AmplifyAppId} --branch-name=$BRANCH_NAME --region=${AWS_REGION}") ]]; then
echo "branch exists, not creating it again"
else
echo "Creating the Amplify branch"
sh -c "aws amplify create-branch --app-id=${AmplifyAppId} --branch-name=$BRANCH_NAME \
${backend_env_arg} ${environment_variables_arg} --region=${AWS_REGION}"

sleep 10
fi
echo "starting job"
Expand Down

0 comments on commit 97414c2

Please sign in to comment.