File tree Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 115
115
"@types/node" : " 18.19.18" ,
116
116
"@types/node-fetch" : " ^2.5.12" ,
117
117
"@types/p-limit" : " ^2.0.0" ,
118
+ "@types/parse-github-url" : " ^1.0.3" ,
118
119
"@types/prettier" : " ^1.16.1" ,
119
120
"@types/readline-sync" : " ^1.4.3" ,
120
121
"@types/voca" : " ^1.4.0" ,
Original file line number Diff line number Diff line change @@ -12,24 +12,24 @@ export const getRepoSlug = () => {
12
12
}
13
13
14
14
const configContent = fs . readFileSync ( gitConfigPath , "utf8" )
15
-
16
15
const parsedConfig = ini . parse ( configContent )
16
+ const remotes : Record < string , any > = { }
17
17
18
- const config : Record < string , any > = { }
19
-
20
- if ( parsedConfig . remote ) {
21
- for ( const remoteName in parsedConfig . remote ) {
22
- config [ `remote "${ remoteName } "` ] = parsedConfig . remote [ remoteName ]
18
+ for ( const key in parsedConfig ) {
19
+ if ( key . startsWith ( 'remote "' ) ) {
20
+ const remoteName = key . substring ( 8 , key . length - 1 )
21
+ remotes [ remoteName ] = parsedConfig [ key ]
23
22
}
24
23
}
25
24
26
- const possibleRemotes = [ config [ 'remote "upstream"' ] , config [ 'remote "origin"' ] ] . filter ( ( f ) => f )
25
+ const possibleRemoteNames = [ "upstream" , "origin" ]
26
+ const possibleRemotes = possibleRemoteNames . map ( ( name ) => remotes [ name ] ) . filter ( ( remote ) => remote && remote . url )
27
+
27
28
if ( possibleRemotes . length === 0 ) {
28
29
return null
29
30
}
30
-
31
31
const ghData = possibleRemotes . map ( ( r ) => parseGithubURL ( r . url ) )
32
- return ghData . length ? ghData [ 0 ] . repo : undefined
32
+ return ghData . length && ghData [ 0 ] ? ghData [ 0 ] . repo : undefined
33
33
} catch ( error ) {
34
34
console . error ( "Error reading git config:" , error )
35
35
return null
Original file line number Diff line number Diff line change 2022
2022
dependencies :
2023
2023
p-limit "*"
2024
2024
2025
+ " @types/parse-github-url@^1.0.3 " :
2026
+ version "1.0.3"
2027
+ resolved "https://registry.yarnpkg.com/@types/parse-github-url/-/parse-github-url-1.0.3.tgz#a097f26ae1993f1963d4031126dc7965707804aa"
2028
+ integrity sha512-7sTbCVmSVzK/iAsHGIxoqiyAnqix9opZm68lOvaU6DBx9EQ9kHMSp0y7Criu2OCsZ9wDllEyCRU+LU4hPRxXUA==
2029
+ dependencies :
2030
+ " @types/node" " *"
2031
+
2025
2032
" @types/parse-path@^7.0.0 " :
2026
2033
version "7.0.3"
2027
2034
resolved "https://registry.yarnpkg.com/@types/parse-path/-/parse-path-7.0.3.tgz#cec2da2834ab58eb2eb579122d9a1fc13bd7ef36"
You can’t perform that action at this time.
0 commit comments