File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
generator/konfig-next-app/src/utils Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -42,25 +42,42 @@ export async function githubSearchFiles({
4242 return JSON . parse ( cached )
4343 }
4444 try {
45+ console . log (
46+ `[GITHUB_SEARCH] Starting search for files with query: filename:${ filename } in repo:${ owner } /${ repo } `
47+ )
4548 const query = `filename:${ filename } repo:${ owner } /${ repo } `
49+ const start = Date . now ( )
4650 const response : SearchResponse = await octokit . search . code ( { q : query } )
51+ console . log (
52+ `[GITHUB_SEARCH] GitHub search API call took ${ Date . now ( ) - start } ms`
53+ )
4754
48- console . debug ( 'response.data' , response . data )
55+ console . debug ( '[GITHUB_SEARCH] response.data' , response . data )
4956
5057 if ( response . data . total_count === 0 ) {
58+ console . log ( '[GITHUB_SEARCH] No files found matching search criteria' )
5159 return null
5260 }
5361
62+ console . log (
63+ `[GITHUB_SEARCH] Found ${ response . data . total_count } matching files`
64+ )
5465 const result = response . data . items . map ( ( item ) => ( {
5566 name : item . name ,
5667 path : item . path ,
5768 url : item . html_url ,
5869 } ) )
70+
71+ const cacheStart = Date . now ( )
5972 await setGithubApiCache ( {
6073 namespace : 'search' ,
6174 key : cacheKey ,
6275 value : JSON . stringify ( result ) ,
6376 } )
77+ console . log (
78+ `[GITHUB_SEARCH] Caching search results took ${ Date . now ( ) - cacheStart } ms`
79+ )
80+
6481 return result
6582 } catch ( error ) {
6683 if ( error instanceof Error )
You can’t perform that action at this time.
0 commit comments