fix: execute git config commands synchronously
this fixes the following error I was running into: error: could not lock config file .git/config: File existsreleases/v3
parent
acd95e2b8f
commit
1607ac70d5
|
@ -31,14 +31,18 @@ module.exports = new (class Git {
|
|||
}
|
||||
}
|
||||
|
||||
// use a self-invoking async function to await promises inside a constructor
|
||||
// this avoids git config lock errors which are triggered when multiple `git config` commands are run
|
||||
(async () => {
|
||||
// Set config
|
||||
this.config('user.name', gitUserName)
|
||||
this.config('user.email', gitUserEmail)
|
||||
await this.config('user.name', gitUserName)
|
||||
await this.config('user.email', gitUserEmail)
|
||||
|
||||
// Update the origin
|
||||
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`)
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue