8000 Merge branch 'init-commit' into releases/v4-init · ushmm/github-pages-deploy-action@781d9e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 781d9e3

Browse files
committed
Merge branch 'init-commit' into releases/v4-init
2 parents b2dd85d + a16ac09 commit 781d9e3

File tree

1 file changed

+26
-44
lines changed

1 file changed

+26
-44
lines changed

src/git.ts

Lines changed: 26 additions & 44 deletions
< 10000 td data-grid-cell-id="diff-2ea4750851b34def3ddd617afa64e175a87064a29dbb9e6fd20eee6f1dd6dc93-42-36-1" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionNum-bgColor, var(--diffBlob-addition-bgColor-num));text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative left-side">36
Original file line numberDiff line numberDiff line change
@@ -21,55 +21,37 @@ export async function init(action: ActionInterface): Promise<void | Error> {
2121
info(`Deploying using ${action.tokenType}… 🔑`)
2222
info('Configuring git…')
2323

24-
async function configure(throwOnError: boolean) {
25-
try {
26-
await execute(
27-
`git config --global --add safe.directory "${action.workspace}"`,
28-
action.workspace,
29-
action.silent
30-
)
24+
await execute(`git init`, action.workspace, action.silent)
3125

32-
await execute(
33-
`git config user.name "${action.name}"`,
34-
action.workspace,
35-
action.silent
36-
)
26+
await execute(
27+
`git commit -m "Initial commit" --allow-empty`,
28+
action.workspace,
29+
action.silent
30+
)
3731

38-
await execute(
39-
`git config user.email "${action.email}"`,
40-
action.workspace,
41-
action.silent
42-
)
32+
await execute(
33+
`git config --global --add safe.directory "${action.workspace}"`,
34+
action.workspace,
35+
action.silent
+
)
4337

44-
await execute(
45-
`git config core.ignorecase false`,
46-
action.workspace,
47-
action.silent
48-
)
49-
} catch {
50-
info(
51-
'There was a problemissue initilizing git, attempting to resolve …'
52-
)
53-
if (throwOnError) {
54-
throw new Error()
55-
}
56-
}
57-
}
38+
await execute(
39+
`git config user.name "${action.name}"`,
40+
action.workspace,
41+
action.silent
42+
)
5843

59-
try {
60-
await configure(false)
61-
} catch {
62-
// Attempt to re-run if initial configuration failed using git init.
63-
await execute(`git init`, action.workspace, action.silent)
44+
await execute(
45+
`git config user.email "${action.email}"`,
46+
action.workspace,
47+
action.silent
48+
)
6449

65-
await execute(
66-
`git commit -m "Initial commit" --allow-empty`,
67-
action.workspace,
68-
action.silent
69-
)
70-
71-
await configure(true)
72-
}
50+
await execute(
51+
`git config core.ignorecase false`,
52+
action.workspace,
53+
action.silent
54+
)
7355

7456
try {
7557
if ((process.env.CI && !action.sshKey) || action.isTest) {

0 commit comments

Comments
 (0)
0