Merge pull request #17 from ahmedwaleedmalik/add-username-email
Add fields to explicitly specify username and email for commit user
This commit is contained in:
		
						commit
						919cd2c154
					
				
					 3 changed files with 26 additions and 2 deletions
				
			
		| 
						 | 
					@ -14,6 +14,8 @@ Inputs:
 | 
				
			||||||
* `target_dir` The target directory to store the charts, defaults to `.`
 | 
					* `target_dir` The target directory to store the charts, defaults to `.`
 | 
				
			||||||
* `helm_version` The Helm CLI version, defaults to the latest release
 | 
					* `helm_version` The Helm CLI version, defaults to the latest release
 | 
				
			||||||
* `linting` Toggle Helm linting, can be disabled by setting it to `off`
 | 
					* `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
 | 
					## Examples
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,4 +61,6 @@ jobs:
 | 
				
			||||||
          repository: charts
 | 
					          repository: charts
 | 
				
			||||||
          branch: gh-pages
 | 
					          branch: gh-pages
 | 
				
			||||||
          target_dir: charts
 | 
					          target_dir: charts
 | 
				
			||||||
 | 
					          commit_username: johndoe
 | 
				
			||||||
 | 
					          commit_email: johndoe@example.com
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								action.yml
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								action.yml
									
										
									
									
									
								
							| 
						 | 
					@ -32,6 +32,14 @@ inputs:
 | 
				
			||||||
  linting:
 | 
					  linting:
 | 
				
			||||||
    description: "Toggle Helm linting, can be disabled by setting it to 'off'"
 | 
					    description: "Toggle Helm linting, can be disabled by setting it to 'off'"
 | 
				
			||||||
    required: false
 | 
					    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:
 | 
					runs:
 | 
				
			||||||
  using: 'docker'
 | 
					  using: 'docker'
 | 
				
			||||||
  image: 'Dockerfile'
 | 
					  image: 'Dockerfile'
 | 
				
			||||||
| 
						 | 
					@ -45,3 +53,5 @@ runs:
 | 
				
			||||||
    - ${{ inputs.target_dir }}
 | 
					    - ${{ inputs.target_dir }}
 | 
				
			||||||
    - ${{ inputs.helm_version }}
 | 
					    - ${{ inputs.helm_version }}
 | 
				
			||||||
    - ${{ inputs.linting }}
 | 
					    - ${{ inputs.linting }}
 | 
				
			||||||
 | 
					    - ${{ inputs.commit_username }}
 | 
				
			||||||
 | 
					    - ${{ inputs.commit_email }}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,6 +26,8 @@ BRANCH=$6
 | 
				
			||||||
TARGET_DIR=$7
 | 
					TARGET_DIR=$7
 | 
				
			||||||
HELM_VERSION=$8
 | 
					HELM_VERSION=$8
 | 
				
			||||||
LINTING=$9
 | 
					LINTING=$9
 | 
				
			||||||
 | 
					COMMIT_USERNAME=$10
 | 
				
			||||||
 | 
					COMMIT_EMAIL=$11
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CHARTS=()
 | 
					CHARTS=()
 | 
				
			||||||
CHARTS_TMP_DIR=$(mktemp -d)
 | 
					CHARTS_TMP_DIR=$(mktemp -d)
 | 
				
			||||||
| 
						 | 
					@ -69,6 +71,14 @@ main() {
 | 
				
			||||||
      REPO_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/${OWNER}/${REPOSITORY}"
 | 
					      REPO_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/${OWNER}/${REPOSITORY}"
 | 
				
			||||||
  fi
 | 
					  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
 | 
					  locate
 | 
				
			||||||
  download
 | 
					  download
 | 
				
			||||||
  dependencies
 | 
					  dependencies
 | 
				
			||||||
| 
						 | 
					@ -122,8 +132,8 @@ upload() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  git clone ${REPO_URL}
 | 
					  git clone ${REPO_URL}
 | 
				
			||||||
  cd ${REPOSITORY}
 | 
					  cd ${REPOSITORY}
 | 
				
			||||||
  git config user.name "${GITHUB_ACTOR}"
 | 
					  git config user.name "${COMMIT_USERNAME}"
 | 
				
			||||||
  git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
 | 
					  git config user.email "${COMMIT_EMAIL}"
 | 
				
			||||||
  git remote set-url origin ${REPO_URL}
 | 
					  git remote set-url origin ${REPO_URL}
 | 
				
			||||||
  git checkout ${BRANCH}
 | 
					  git checkout ${BRANCH}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue