File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,18 @@ module.exports = new (class Git {
31
31
}
32
32
}
33
33
34
- // Set config
35
- this . config ( 'user.name' , gitUserName )
36
- this . config ( 'user.email' , gitUserEmail )
37
-
38
- // Update the origin
39
- if ( githubToken ) {
40
- this . updateOrigin ( `https://x-access-token:${ githubToken } @${ gitUrl } /${ GITHUB_REPOSITORY } .git` )
41
- }
34
+ // use a self-invoking async function to await promises inside a constructor
35
+ // this avoids git config lock errors which are triggered when multiple `git config` commands are run
36
+ ( async ( ) => {
37
+ // Set config
38
+ await this . config ( 'user.name' , gitUserName )
39
+ await this . config ( 'user.email' , gitUserEmail )
40
+
41
+ // Update the origin
42
+ if ( githubToken ) {
43
+ await this . updateOrigin ( `https://x-access-token:${ githubToken } @${ gitUrl } /${ GITHUB_REPOSITORY } .git` )
44
+ }
45
+ } ) ( )
42
46
}
43
47
44
48
/**
You can’t perform that action at this time.
0 commit comments