Merge pull request #213 from iloveitaly/sync-git-config
fix: execute git config commands synchronouslyreleases/v3
commit
d479ae227c
|
@ -14,10 +14,6 @@ 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')
|
|
||||||
const gitUrl = core.getInput('git-url')
|
|
||||||
|
|
||||||
// if the env is dont-use-git then we mock exec as we are testing a workflow
|
// if the env is dont-use-git then we mock exec as we are testing a workflow
|
||||||
if (ENV === 'dont-use-git') {
|
if (ENV === 'dont-use-git') {
|
||||||
this.exec = (command) => {
|
this.exec = (command) => {
|
||||||
|
@ -30,14 +26,21 @@ module.exports = new (class Git {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init = async () => {
|
||||||
|
const gitUserName = core.getInput('git-user-name')
|
||||||
|
const gitUserEmail = core.getInput('git-user-email')
|
||||||
|
const gitUrl = core.getInput('git-url')
|
||||||
|
const githubToken = core.getInput('github-token')
|
||||||
|
|
||||||
// Set config
|
// Set config
|
||||||
this.config('user.name', gitUserName)
|
await this.config('user.name', gitUserName)
|
||||||
this.config('user.email', gitUserEmail)
|
await this.config('user.email', gitUserEmail)
|
||||||
|
|
||||||
// Update the origin
|
// Update the origin
|
||||||
if (githubToken) {
|
if (githubToken) {
|
||||||
this.updateOrigin(`https://x-access-token:${githubToken}@${gitUrl}/${GITHUB_REPOSITORY}.git`)
|
await this.updateOrigin(`https://x-access-token:${githubToken}@${gitUrl}/${GITHUB_REPOSITORY}.git`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,8 @@ async function run() {
|
||||||
core.info(`Skipping empty releases is "${skipEmptyRelease ? 'enabled' : 'disabled'}"`)
|
core.info(`Skipping empty releases is "${skipEmptyRelease ? 'enabled' : 'disabled'}"`)
|
||||||
core.info(`Skipping the update of the version file is "${skipVersionFile ? 'enabled' : 'disabled'}"`)
|
core.info(`Skipping the update of the version file is "${skipVersionFile ? 'enabled' : 'disabled'}"`)
|
||||||
|
|
||||||
|
await git.init()
|
||||||
|
|
||||||
if (!skipGitPull) {
|
if (!skipGitPull) {
|
||||||
core.info('Pull to make sure we have the full git history')
|
core.info('Pull to make sure we have the full git history')
|
||||||
await git.pull()
|
await git.pull()
|
||||||
|
|
Loading…
Reference in New Issue