@@ -9,10 +9,12 @@ import {
99 getApiDetails ,
1010 getGitHubVersion ,
1111 InstanceApiClient ,
12+ type GitHubApiDetails ,
1213} from "./api-client" ;
1314import * as artifactScanner from "./artifact-scanner" ;
1415import { Config } from "./config-utils" ;
1516import * as defaults from "./defaults.json" ;
17+ import type { ReadOnlyEnv } from "./environment" ;
1618import {
1719 CodeQLDefaultVersionInfo ,
1820 Feature ,
@@ -395,8 +397,12 @@ export function getFallbackUrl(proxyPackage: string): string {
395397 *
396398 * @returns The response from the GitHub API.
397399 */
398- async function getReleaseByVersion ( version : string ) {
399- return getApiClient ( ) . rest . repos . getReleaseByTag ( {
400+ async function getReleaseByVersion (
401+ env : ReadOnlyEnv ,
402+ apiDetails : GitHubApiDetails ,
403+ version : string ,
404+ ) {
405+ return getApiClient ( env , apiDetails ) . rest . repos . getReleaseByTag ( {
400406 owner : "github" ,
401407 repo : "codeql-action" ,
402408 tag : version ,
@@ -419,7 +425,8 @@ async function getCliVersionFromFeatures(
419425 * @returns Returns the download URL and version of the proxy package we plan to use.
420426 */
421427export async function getDownloadUrl (
422- action : ActionState < [ "Base" , "Logger" , "FeatureFlags" ] > ,
428+ action : ActionState < [ "Base" , "ReadOnlyEnv" , "Logger" , "FeatureFlags" ] > ,
429+ apiDetails : GitHubApiDetails ,
423430) : Promise < { url : string ; version : string } > {
424431 // Default to linux64 if we don't recognise the platform+arch pair.
425432 // This maintains the behaviour we had before switching to `getBundlePlatform` here.
@@ -448,7 +455,11 @@ export async function getDownloadUrl(
448455 } ;
449456
450457 // Try to retrieve information about the CLI bundle release identified by `versionInfo`.
451- const cliRelease = await getReleaseByVersion ( versionInfo . tagName ) ;
458+ const cliRelease = await getReleaseByVersion (
459+ action . env ,
460+ apiDetails ,
461+ versionInfo . tagName ,
462+ ) ;
452463
453464 // Search the release's assets to find the one we are looking for.
454465 for ( const asset of cliRelease . data . assets ) {
@@ -569,13 +580,13 @@ export function getProxyFilename() {
569580 * @returns The path to the proxy binary.
570581 */
571582export async function getProxyBinaryPath (
572- action : ActionState < [ "Base" , "Logger" , "FeatureFlags" ] > ,
583+ action : ActionState < [ "Base" , "ReadOnlyEnv" , " Logger", "FeatureFlags" ] > ,
573584) : Promise < string > {
574585 const logger = action . logger ;
575586 const apiDetails = getApiDetails ( ) ;
576587 const client = new InstanceApiClient ( apiDetails ) ;
577588 const proxyFileName = getProxyFilename ( ) ;
578- const proxyInfo = await getDownloadUrl ( action ) ;
589+ const proxyInfo = await getDownloadUrl ( action , apiDetails ) ;
579590
580591 let proxyBin = toolcache . find ( proxyFileName , proxyInfo . version ) ;
581592 if ( ! proxyBin ) {
0 commit comments