feat: More git configurations are possible

You can now set the git user.name and git user.email and also change the pull method used by git
releases/v3
Tycho Bokdam 2020-06-28 20:12:32 +02:00
parent 7023ea0a81
commit 9ee9c27448
No known key found for this signature in database
GPG Key ID: A0FAE77C8CDF33C7
2 changed files with 21 additions and 3 deletions

View File

@ -19,6 +19,21 @@ inputs:
default: 'chore(release): {version}' default: 'chore(release): {version}'
required: false required: false
git-user-name:
description: 'The git user.name to use for the commit'
default: 'Conventional Changelog Action'
required: false
git-user-email:
description: 'The git user.email to use for the commit'
default: 'conventional.changelog.action@github.com'
required: false
git-pull-method:
description: 'The git pull method used when pulling all changes from remote'
default: '--ff-only'
required: false
preset: preset:
description: 'The preset from Conventional Changelog to use' description: 'The preset from Conventional Changelog to use'
default: 'angular' default: 'angular'

View File

@ -13,9 +13,12 @@ module.exports = new (class Git {
// Make the Github token secret // Make the Github token secret
core.setSecret(githubToken) core.setSecret(githubToken)
const gitUserName = core.getInput('git-user-name')
const gitUserEmail = core.getInput('git-user-email')
// Set config // Set config
this.config('user.name', 'Conventional Changelog Action') this.config('user.name', gitUserName)
this.config('user.email', 'conventional.changelog.action@github.com') this.config('user.email', gitUserEmail)
// Update the origin // Update the origin
this.updateOrigin(`https://x-access-token:${githubToken}@github.com/${GITHUB_REPOSITORY}.git`) this.updateOrigin(`https://x-access-token:${githubToken}@github.com/${GITHUB_REPOSITORY}.git`)
@ -90,7 +93,7 @@ module.exports = new (class Git {
* @return {Promise<>} * @return {Promise<>}
*/ */
pull = () => ( pull = () => (
this.exec(`pull --unshallow`) this.exec(`pull --unshallow ${core.getInput('git-pull-method')}`)
) )
/** /**