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 29, 2024
1 parent 60dddf8 commit 3484068
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,14 +53,14 @@ 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 [[ -z $(aws amplify get-branch --app-id=${AmplifyAppId} --branch-name=$BRANCH_NAME --region=${AWS_REGION} 2> /dev/null) ]]; then
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
else
echo "branch exists, not creating it again"
fi
echo "starting job"

Expand Down

0 comments on commit 3484068

Please sign in to comment.