Merge pull request #10 from ad-m/ad-m-patch-1

Add use cases to README
diff --git a/README.md b/README.md
index d11fda0..d718ded 100644
--- a/README.md
+++ b/README.md
@@ -38,10 +38,11 @@
 
 | name | value | default | description |
 | ---- | ----- | ------- | ----------- |
-| github_token | string | | Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}'. |
+| github_token | string | | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`. |
 | branch | string | 'master' | Destination branch to push changes. |
 | force | boolean | false | Determines if force push is used. |
 | directory | string | '.' | Directory to change to before pushing. |
+| repository | string | '' | Repository name. Default or empty repository name represents current github repository. If you want to push to other repository, you should make a [personal access token](https://github.com/settings/tokens) and use it as the `github_token` input.  |
 
 ## License
 
diff --git a/action.yml b/action.yml
index 09ccdc4..8035b8b 100644
--- a/action.yml
+++ b/action.yml
@@ -6,8 +6,12 @@
   color: green
 inputs:
   github_token:
-    description: 'Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
+    description: 'Token for the repo. Can be passed in using ${{ secrets.GITHUB_TOKEN }}'
     required: true
+  repository:
+    description: 'Repository name to push. Default or empty value represents current github repository (${GITHUB_REPOSITORY})'
+    default: ''
+    required: false
   branch:
     description: 'Destination branch to push changes'
     required: false
diff --git a/start.sh b/start.sh
index 9164fa5..d2e58db 100755
--- a/start.sh
+++ b/start.sh
@@ -5,6 +5,7 @@
 INPUT_FORCE=${INPUT_FORCE:-false}
 INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'}
 _FORCE_OPTION=''
+REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
 
 echo "Push to branch $INPUT_BRANCH";
 [ -z "${INPUT_GITHUB_TOKEN}" ] && {
@@ -18,8 +19,6 @@
 
 cd ${INPUT_DIRECTORY}
 
-# Ensure that the remote of the git repository of the current directory still is the repository where the github action is executed
-git remote add origin https://github.com/${GITHUB_REPOSITORY} || git remote set-url origin https://github.com/${GITHUB_REPOSITORY} || true
+remote_repo="https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
 
-header=$(echo -n "ad-m:${INPUT_GITHUB_TOKEN}" | base64)
-git -c http.extraheader="AUTHORIZATION: basic $header" push origin HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION;
+git push "${remote_repo}" HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION;