From 012a068dd01e6b0b738f978f09f38f517dc505a5 Mon Sep 17 00:00:00 2001
From: Waleed Malik <ahmedwaleedmalik@gmail.com>
Date: Mon, 30 Nov 2020 10:05:08 +0500
Subject: [PATCH 1/3] Add fields to explicitly specify username and email for
 commit user

---
 README.md         |  4 ++++
 action.yml        |  8 ++++++++
 src/entrypoint.sh | 14 ++++++++++++--
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 7a1f63c..400306a 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,8 @@ Inputs:
 * `target_dir` The target directory to store the charts, defaults to `.`
 * `helm_version` The Helm CLI version, defaults to the latest release
 * `linting` Toggle Helm linting, can be disabled by setting it to `off`
+* `commit_username` Explicitly specify username for commit back, default to `GITHUB_ACTOR`
+* `commit_email` Explicitly specify email for commit back, default to `GITHUB_ACTOR@users.noreply.github.com`
 
 ## Examples
 
@@ -59,4 +61,6 @@ jobs:
           repository: charts
           branch: gh-pages
           target_dir: charts
+          commit_username: johndoe
+          commit_email: johndoe@example.com
 ```
diff --git a/action.yml b/action.yml
index 27f03bb..d96e8ee 100644
--- a/action.yml
+++ b/action.yml
@@ -32,6 +32,14 @@ inputs:
   linting:
     description: "Toggle Helm linting, can be disabled by setting it to 'off'"
     required: false
+  commit_username:
+    description: "The user name used for the commit user"
+    required: false
+    default: "$GITHUB_ACTOR"
+  commit_email:
+    description: "The email used for the commit user"
+    required: false
+    default: "$GITHUB_ACTOR@users.noreply.github.com"
 runs:
   using: 'docker'
   image: 'Dockerfile'
diff --git a/src/entrypoint.sh b/src/entrypoint.sh
index 0930417..4b7bd9c 100644
--- a/src/entrypoint.sh
+++ b/src/entrypoint.sh
@@ -26,6 +26,8 @@ BRANCH=$6
 TARGET_DIR=$7
 HELM_VERSION=$8
 LINTING=$9
+COMMIT_USERNAME=$10
+COMMIT_EMAIL=$11
 
 CHARTS=()
 CHARTS_TMP_DIR=$(mktemp -d)
@@ -69,6 +71,14 @@ main() {
       REPO_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/${OWNER}/${REPOSITORY}"
   fi
 
+  if [[ -z "$COMMIT_USERNAME" ]]; then
+      COMMIT_USERNAME="${GITHUB_ACTOR}"
+  fi
+
+  if [[ -z "$COMMIT_EMAIL" ]]; then
+      COMMIT_EMAIL="${GITHUB_ACTOR}@users.noreply.github.com"
+  fi
+
   locate
   download
   dependencies
@@ -122,8 +132,8 @@ upload() {
 
   git clone ${REPO_URL}
   cd ${REPOSITORY}
-  git config user.name "${GITHUB_ACTOR}"
-  git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
+  git config user.name "${COMMIT_USERNAME}"
+  git config user.email "${COMMIT_EMAIL}"
   git remote set-url origin ${REPO_URL}
   git checkout ${BRANCH}
 

From c926e0782e69269b10960e2bca7107d68c5fd089 Mon Sep 17 00:00:00 2001
From: Waleed Malik <ahmedwaleedmalik@gmail.com>
Date: Mon, 30 Nov 2020 10:38:36 +0500
Subject: [PATCH 2/3] Add username and email args for docker image

---
 action.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/action.yml b/action.yml
index d96e8ee..e637dcc 100644
--- a/action.yml
+++ b/action.yml
@@ -53,3 +53,5 @@ runs:
     - ${{ inputs.target_dir }}
     - ${{ inputs.helm_version }}
     - ${{ inputs.linting }}
+    - ${{ inputs.commit_username }}
+    - ${{ inputs.commit_email }}

From 74024b32a9b58a5ecab24ddafb83ee97b375d020 Mon Sep 17 00:00:00 2001
From: Waleed Malik <ahmedwaleedmalik@gmail.com>
Date: Mon, 30 Nov 2020 15:06:56 +0500
Subject: [PATCH 3/3] Add default values for commit username and password

---
 action.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/action.yml b/action.yml
index e637dcc..002ea9e 100644
--- a/action.yml
+++ b/action.yml
@@ -35,11 +35,11 @@ inputs:
   commit_username:
     description: "The user name used for the commit user"
     required: false
-    default: "$GITHUB_ACTOR"
+    default: ${{ github.actor }} 
   commit_email:
     description: "The email used for the commit user"
     required: false
-    default: "$GITHUB_ACTOR@users.noreply.github.com"
+    default: ${{ github.actor }}@users.noreply.github.com
 runs:
   using: 'docker'
   image: 'Dockerfile'