@@ -21,52 +21,37 @@ export async function init(action: ActionInterface): Promise<void | Error> {
21
21
info ( `Deploying using ${ action . tokenType } … 🔑` )
22
22
info ( 'Configuring git…' )
23
23
24
- async function configureGit ( 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 )
31
25
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
+ )
37
31
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
36
+ )
43
37
44
- await execute (
45
- `git config core.ignorecase false` ,
46
- action . workspace ,
47
- action . silent
48
- )
49
- } catch {
50
- if ( throwOnError ) {
51
- throw new Error ( )
52
- }
53
- }
54
- }
38
+ await execute (
39
+ `git config user.name "${ action . name } "` ,
40
+ action . workspace ,
41
+ action . silent
42
+ )
55
43
56
- try {
57
- await configureGit ( false )
58
- } catch {
59
- // Attempt to re-run if initial configuration failed using git init.
60
- 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
+ )
61
49
62
- await execute (
63
- `git commit -m "Initial commit" --allow-empty` ,
64
- action . workspace ,
65
- action . silent
66
- )
67
-
68
- await configureGit ( true )
69
- }
50
+ await execute (
51
+ `git config core.ignorecase false` ,
52
+ action . workspace ,
53
+ action . silent
54
+ )
70
55
71
56
try {
72
57
if ( ( process . env . CI && ! action . sshKey ) || action . isTest ) {
0 commit comments