mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
Update git.ts
This commit is contained in:
parent
c46739c7bd
commit
81db737cc8
@ -21,7 +21,7 @@ export async function init(action: ActionInterface): Promise<void | Error> {
|
|||||||
info(`Deploying using ${action.tokenType}… 🔑`)
|
info(`Deploying using ${action.tokenType}… 🔑`)
|
||||||
info('Configuring git…')
|
info('Configuring git…')
|
||||||
|
|
||||||
async function configureGit(throwOnError: boolean) {
|
async function configure(throwOnError: boolean) {
|
||||||
try {
|
try {
|
||||||
await execute(
|
await execute(
|
||||||
`git config --global --add safe.directory "${action.workspace}"`,
|
`git config --global --add safe.directory "${action.workspace}"`,
|
||||||
@ -47,6 +47,9 @@ export async function init(action: ActionInterface): Promise<void | Error> {
|
|||||||
action.silent
|
action.silent
|
||||||
)
|
)
|
||||||
} catch {
|
} catch {
|
||||||
|
info(
|
||||||
|
'There was a problemissue initilizing git, attempting to resolve …'
|
||||||
|
)
|
||||||
if (throwOnError) {
|
if (throwOnError) {
|
||||||
throw new Error()
|
throw new Error()
|
||||||
}
|
}
|
||||||
@ -54,7 +57,7 @@ export async function init(action: ActionInterface): Promise<void | Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await configureGit(false)
|
await configure(false)
|
||||||
} catch {
|
} catch {
|
||||||
// Attempt to re-run if initial configuration failed using git init.
|
// Attempt to re-run if initial configuration failed using git init.
|
||||||
await execute(`git init`, action.workspace, action.silent)
|
await execute(`git init`, action.workspace, action.silent)
|
||||||
@ -65,7 +68,7 @@ export async function init(action: ActionInterface): Promise<void | Error> {
|
|||||||
action.silent
|
action.silent
|
||||||
)
|
)
|
||||||
|
|
||||||
await configureGit(true)
|
await configure(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user