From 78e43d6eea9f4e870dfa9501625000e87022fa63 Mon Sep 17 00:00:00 2001 From: "Jesse L.K. Overton" Date: Wed, 10 Apr 2019 19:52:17 -0400 Subject: [PATCH] Add support for custom local branch names --- README.md | 1 + entrypoint.sh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e89705..e250d65 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ action "Git Push to Production" { | Name | Type | Usage | |-|-|-| | `WPENGINE_ENVIRONMENT` | Environment Variable | Defaults to `production`. You shouldn't need to change this, but if you're using WP Engine's legacy staging, you can override the default and set to `staging` if needed. | +| `LOCAL_BRANCH` | Environment Variable | Set which branch in your repository you'd like to push to WP Engine. Defaults to `master`. | ### Further reading diff --git a/entrypoint.sh b/entrypoint.sh index 6156f1b..0a493e8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,6 +13,8 @@ WPENGINE_SSH_KEY_PRIVATE_PATH="$SSH_PATH/wpengine_key" WPENGINE_SSH_KEY_PUBLIC_PATH="$SSH_PATH/wpengine_key.pub" WPENGINE_ENVIRONMENT_DEFAULT="production" WPENGINE_ENV=${WPENGINE_ENVIRONMENT:-$WPENGINE_ENVIRONMENT_DEFAULT} +LOCAL_BRANCH_DEFAULT="master" +BRANCH=${LOCAL_BRANCH:-$LOCAL_BRANCH_DEFAULT} mkdir "$SSH_PATH" @@ -28,4 +30,4 @@ chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git -git push -fu $WPENGINE_ENV master +git push -fu $WPENGINE_ENV $BRANCH:master