File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
catalog-analytics/app/api/github/ci-status Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -48,24 +48,25 @@ export async function POST(request: Request) {
4848 } , { } as Record < string , CIStatus > ) ;
4949
5050 return NextResponse . json ( statusMap ) ;
51+ }
52+
53+ // Fetch CI status for all repos in parallel
54+ const statusPromises = repositories . map ( async ( repo_id ) => {
5155 // Validate repo_id before using it in an outbound request
52- if ( typeof repo_id !== 'string' || ! isValidRepoId ( repo_id ) ) {
56+ const repoIdStr = String ( repo_id ) . trim ( ) ;
57+ if ( ! isValidRepoId ( repoIdStr ) ) {
5358 return {
54- repo_id : String ( repo_id ) ,
59+ repo_id : repoIdStr ,
5560 state : 'unknown' as const ,
5661 total_checks : 0 ,
5762 updated_at : new Date ( ) . toISOString ( ) ,
5863 details : 'Invalid repository identifier' ,
5964 } ;
6065 }
6166
62- }
63-
64- // Fetch CI status for all repos in parallel
65- const statusPromises = repositories . map ( async ( repo_id ) => {
6667 try {
6768 const response = await fetch (
68- `https://api.github.com/repos/${ repo_id . trim ( ) } /commits/main/status` ,
69+ `https://api.github.com/repos/${ repoIdStr } /commits/main/status` ,
6970 {
7071 headers : {
7172 'Authorization' : `Bearer ${ token } ` ,
You can’t perform that action at this time.
0 commit comments