@@ -258,25 +258,28 @@ export async function runRemoteQuery(
258258 } ) ;
259259
260260 const actionBranch = getActionBranch ( ) ;
261- const workflowRunId = await runRemoteQueriesApiRequest ( credentials , actionBranch , language , repoSelection , owner , repo , base64Pack , dryRun ) ;
261+ const apiResponse = await runRemoteQueriesApiRequest ( credentials , actionBranch , language , repoSelection , owner , repo , base64Pack , dryRun ) ;
262262 const queryStartTime = Date . now ( ) ;
263263 const queryMetadata = await tryGetQueryMetadata ( cliServer , queryFile ) ;
264264
265265 if ( dryRun ) {
266266 return { queryDirPath : remoteQueryDir . path } ;
267267 } else {
268- if ( ! workflowRunId ) {
268+ if ( ! apiResponse ) {
269269 return ;
270270 }
271271
272+ const workflowRunId = apiResponse . workflow_run_id ;
273+ const numRepositoriesQueried = apiResponse . repositories_queried . length ;
272274 const remoteQuery = await buildRemoteQueryEntity (
273275 queryFile ,
274276 queryMetadata ,
275277 owner ,
276278 repo ,
277279 queryStartTime ,
278280 workflowRunId ,
279- language ) ;
281+ language ,
282+ numRepositoriesQueried ) ;
280283
281284 // don't return the path because it has been deleted
282285 return { query : remoteQuery } ;
@@ -301,7 +304,7 @@ async function runRemoteQueriesApiRequest(
301304 repo : string ,
302305 queryPackBase64 : string ,
303306 dryRun = false
304- ) : Promise < void | number > {
307+ ) : Promise < void | QueriesResponse > {
305308 const data = {
306309 ref,
307310 language,
@@ -336,7 +339,7 @@ async function runRemoteQueriesApiRequest(
336339 ) ;
337340 const { popupMessage, logMessage } = parseResponse ( owner , repo , response . data ) ;
338341 void showAndLogInformationMessage ( popupMessage , { fullMessage : logMessage } ) ;
339- return response . data . workflow_run_id ;
342+ return response . data ;
340343 } catch ( error : any ) {
341344 if ( error . status === 404 ) {
342345 void showAndLogErrorMessage ( `Controller repository was not found. Please make sure it's a valid repo name.${ eol } ` ) ;
@@ -432,7 +435,8 @@ async function buildRemoteQueryEntity(
432435 controllerRepoName : string ,
433436 queryStartTime : number ,
434437 workflowRunId : number ,
435- language : string
438+ language : string ,
439+ numRepositoriesQueried : number
436440) : Promise < RemoteQuery > {
437441 // The query name is either the name as specified in the query metadata, or the file name.
438442 const queryName = queryMetadata ?. name ?? path . basename ( queryFilePath ) ;
@@ -449,6 +453,7 @@ async function buildRemoteQueryEntity(
449453 name : controllerRepoName ,
450454 } ,
451455 executionStartTime : queryStartTime ,
452- actionsWorkflowRunId : workflowRunId
456+ actionsWorkflowRunId : workflowRunId ,
457+ numRepositoriesQueried : numRepositoriesQueried ,
453458 } ;
454459}
0 commit comments