@@ -20,9 +20,12 @@ async function ghApiFetch<T>(endpoint: string, token: string): Promise<T> {
2020}
2121
2222async function resolveNightlyRunId ( repo : string , token : string , date ?: string , branch ?: string ) : Promise < number > {
23- const query = "status=success&per_page=1" + ( branch ? `&branch=${ branch } ` : "" ) + ( date ? `&created=${ date } ` : "" ) ;
24- const { workflow_runs} = await ghApiFetch < WorkflowRunsResponse > (
25- `/repos/${ repo } /actions/workflows/tests.yml/runs?${ query } ` ,
23+ const params = new URLSearchParams ( { status : "success" , per_page : "1" } ) ;
24+ if ( branch ) params . append ( "branch" , branch ) ;
25+ if ( date ) params . append ( "created" , date ) ;
26+
27+ const { workflow_runs } = await ghApiFetch < WorkflowRunsResponse > (
28+ `/repos/${ repo } /actions/workflows/tests.yml/runs?${ params } ` ,
2629 token
2730 ) ;
2831
@@ -50,10 +53,7 @@ export async function downloadNightlyTests(
5053 const runId = await resolveNightlyRunId ( repo , token , resolvedDate , opts . branch ) ;
5154 log ( `Resolved nightly${ resolvedDate ? ` ${ resolvedDate } ` : "" } to run ${ runId } ` ) ;
5255
53- const { artifacts} = await ghApiFetch < ArtifactsListResponse > (
54- `/repos/${ repo } /actions/runs/${ runId } /artifacts` ,
55- token
56- ) ;
56+ const { artifacts} = await ghApiFetch < ArtifactsListResponse > ( `/repos/${ repo } /actions/runs/${ runId } /artifacts` , token ) ;
5757
5858 const urlByTest : Record < string , string > = { } ;
5959 const available : string [ ] = [ ] ;
0 commit comments