From 97f9868da0506d022d387d069d0e91861105744b Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Fri, 20 Sep 2019 20:26:41 +0200
Subject: [PATCH] Rename ref to branch

---
 README.md     | 5 +++--
 actions.yml   | 2 +-
 entrypoint.sh | 6 +++---
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index a287fcd..6924bf7 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ Add the following step at the end of your job.
     commit_author_email: john.doe@example.com
     commit_author_name: John Doe
     commit_message: Apply automatic changes
-    ref: ${{ github.head_ref }}
+    branch: ${{ github.head_ref }}
   env:
     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 ```
@@ -33,7 +33,7 @@ The following inputs are required
 - `commit_author_email`: The Commit Authors Email Address
 - `commit_author_name`: The Commit Authors Name
 - `commit_message`: The commit message used when changes are available
-- `ref`: Branch where changes should be pushed too
+- `branch`: Branch name where changes should be pushed to
 
 ### Environment Variables
 
@@ -68,6 +68,7 @@ jobs:
         commit_author_email: hello@stefanzweifel.io
         commit_author_name: Stefan Zweifel
         commit_message: Apply php-cs-fixer changes
+        branch: ${{ github.head_ref }}
       env:
         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
diff --git a/actions.yml b/actions.yml
index 2afa7bd..6fb8688 100644
--- a/actions.yml
+++ b/actions.yml
@@ -13,7 +13,7 @@ inputs:
   commit_author_email:
     description: Email address of the commit author
     required: true
-  ref:
+  branch:
     description: Branch where changes should be pushed too
     required: true
 
diff --git a/entrypoint.sh b/entrypoint.sh
index 2c7d76d..f074609 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -25,16 +25,16 @@ if ! git diff --quiet
 then
     git_setup
 
-    echo "INPUT_REF value: $INPUT_REF";
+    echo "INPUT_BRANCH value: $INPUT_BRANCH";
 
     # Switch to branch from current Workflow run
-    git checkout $INPUT_REF
+    git checkout $INPUT_BRANCH
 
     git add .
 
     git commit -m "$INPUT_COMMIT_MESSAGE" --author="$INPUT_COMMIT_AUTHOR_NAME <$INPUT_COMMIT_AUTHOR_EMAIL>"
 
-    git push --set-upstream origin "HEAD:$INPUT_REF"
+    git push --set-upstream origin "HEAD:$INPUT_BRANCH"
 else
     echo "Working tree clean. Nothing to commit."
 fi