Skip to content

Commit 919cd2c

Browse files
authored
Merge pull request #17 from ahmedwaleedmalik/add-username-email
Add fields to explicitly specify username and email for commit user
2 parents 3d92cc3 + 74024b3 commit 919cd2c

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Inputs:
1414
* `target_dir` The target directory to store the charts, defaults to `.`
1515
* `helm_version` The Helm CLI version, defaults to the latest release
1616
* `linting` Toggle Helm linting, can be disabled by setting it to `off`
17+
* `commit_username` Explicitly specify username for commit back, default to `GITHUB_ACTOR`
18+
* `commit_email` Explicitly specify email for commit back, default to `GITHUB_ACTOR@users.noreply.github.com`
1719

1820
## Examples
1921

@@ -59,4 +61,6 @@ jobs:
5961
repository: charts
6062
branch: gh-pages
6163
target_dir: charts
64+
commit_username: johndoe
65+
commit_email: johndoe@example.com
6266
```

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ inputs:
3232
linting:
3333
description: "Toggle Helm linting, can be disabled by setting it to 'off'"
3434
required: false
35+
commit_username:
36+
description: "The user name used for the commit user"
37+
required: false
38+
default: ${{ github.actor }}
39+
commit_email:
40+
description: "The email used for the commit user"
41+
required: false
42+
default: ${{ github.actor }}@users.noreply.github.com
3543
runs:
3644
using: 'docker'
3745
image: 'Dockerfile'
@@ -45,3 +53,5 @@ runs:
4553
- ${{ inputs.target_dir }}
4654
- ${{ inputs.helm_version }}
4755
- ${{ inputs.linting }}
56+
- ${{ inputs.commit_username }}
57+
- ${{ inputs.commit_email }}

src/entrypoint.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ BRANCH=$6
2626
TARGET_DIR=$7
2727
HELM_VERSION=$8
2828
LINTING=$9
29+
COMMIT_USERNAME=$10
30+
COMMIT_EMAIL=$11
2931

3032
CHARTS=()
3133
CHARTS_TMP_DIR=$(mktemp -d)
@@ -69,6 +71,14 @@ main() {
6971
REPO_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/${OWNER}/${REPOSITORY}"
7072
fi
7173

74+
if [[ -z "$COMMIT_USERNAME" ]]; then
75+
COMMIT_USERNAME="${GITHUB_ACTOR}"
76+
fi
77+
78+
if [[ -z "$COMMIT_EMAIL" ]]; then
79+
COMMIT_EMAIL="${GITHUB_ACTOR}@users.noreply.github.com"
80+
fi
81+
7282
locate
7383
download
7484
dependencies
@@ -122,8 +132,8 @@ upload() {
122132

123133
git clone ${REPO_URL}
124134
cd ${REPOSITORY}
125-
git config user.name "${GITHUB_ACTOR}"
126-
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
135+
git config user.name "${COMMIT_USERNAME}"
136+
git config user.email "${COMMIT_EMAIL}"
127137
git remote set-url origin ${REPO_URL}
128138
git checkout ${BRANCH}
129139

0 commit comments

Comments
 (0)