File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,11 @@ export const readConfig = async (
1414) : Promise < Config > => {
1515 const content : string = readFile ( config , userConfigPath ) ;
1616
17- const remoteConfig : Config = await readRemoteConfig ( repo , userConfigPath ) ;
17+ const remoteConfig : Config = await readRemoteConfig (
18+ config ,
19+ repo ,
20+ userConfigPath ,
21+ ) ;
1822
1923 if ( content === "" ) {
2024 return < Config > merge ( defaultConfig , remoteConfig , config ) ;
@@ -26,6 +30,7 @@ export const readConfig = async (
2630} ;
2731
2832export const readRemoteConfig = async (
33+ config : Config ,
2934 repo : Repository | undefined ,
3035 filename : string ,
3136) : Promise < Config > => {
@@ -34,10 +39,19 @@ export const readRemoteConfig = async (
3439 return < Config > { } ;
3540 }
3641
37- const response : string = await repo . getRawFile ( filename ) ;
42+ const response1 : string = await repo . getRawFile ( ".github" , filename ) ;
43+
44+ if ( response1 !== "" ) {
45+ return < Config > yaml . load ( response1 ) ;
46+ }
47+
48+ const response2 : string = await repo . getRawFile (
49+ config . repository ?. owner || ".github" ,
50+ filename ,
51+ ) ;
3852
39- if ( response !== "" ) {
40- return < Config > yaml . load ( response ) ;
53+ if ( response2 !== "" ) {
54+ return < Config > yaml . load ( response2 ) ;
4155 }
4256
4357 return < Config > { } ;
Original file line number Diff line number Diff line change @@ -202,13 +202,13 @@ export class Repository {
202202 }
203203 }
204204
205- async getRawFile ( filename : string ) : Promise < string > {
205+ async getRawFile ( repo : string , filename : string ) : Promise < string > {
206206 try {
207207 const response = await this . _octokit . rest . repos . getContent ( <
208208 RestEndpointMethodTypes [ "repos" ] [ "getContent" ] [ "parameters" ]
209209 > {
210210 owner : this . _config . repository ?. owner ,
211- repo : ".github" ,
211+ repo : repo ,
212212 path : filename ,
213213 headers : {
214214 Accept : "application/vnd.github.v3.raw" ,
You can’t perform that action at this time.
0 commit comments