33import * as core from "@actions/core" ;
44import * as install from "./install" ;
55
6- //function resolving whether to install dependencies based on the input and runner type
7- export function resolveInstallDependencies ( input : string ) : boolean {
8- if ( input . toLowerCase ( ) === 'true' ) {
9- core . info ( `install-system-dependencies explicitly set to true` ) ;
10- return true ;
11- }
12- if ( input . toLowerCase ( ) === 'false' ) {
13- core . info ( `install-system-dependencies explicitly set to false` ) ;
14- return false ;
15- }
16-
17- // when expliciatlly not set to true or false then detecting based on the runner type
18- if ( input . toLowerCase ( ) === 'auto' || input === '' ) {
19- //using the same detection method for github hosted runner as in install.ts
20- const runnerEnvironment = process . env [ "RUNNER_ENVIRONMENT" ] ;
21- const agentIsSelfHosted = process . env [ "AGENT_ISSELFHOSTED" ] ;
22-
23- const isGitHubHosted = runnerEnvironment === "github-hosted" && agentIsSelfHosted !== "1" ;
24-
25- // shouldInstall will return true for github-hosted and false for self-hosted
26- const shouldInstall = isGitHubHosted ;
27-
28- core . info ( `Auto-detected runner type: ${ isGitHubHosted ? 'GitHub-hosted' : 'self-hosted' } ` ) ;
29- core . info ( `System dependencies will ${ shouldInstall ? 'be' : 'not be' } installed (auto mode)` ) ;
30-
31- return shouldInstall ;
32- }
33-
34- // default set to false for invalid input type
35- core . warning ( `Invalid value for install-system-dependencies: ${ input } . Defaulting to false.` ) ;
36- return false ;
37- }
386
397/**
408 * Gather action inputs and then run action.
@@ -45,8 +13,7 @@ export async function run() {
4513 const release = core . getInput ( "release" ) ;
4614 const products = core . getMultilineInput ( "products" ) ;
4715 const cache = core . getBooleanInput ( "cache" ) ;
48- const installDepsInput = core . getInput ( "install-system-dependencies" ) || 'auto' ;
49- const installSystemDependencies = resolveInstallDependencies ( installDepsInput ) ;
16+ const installSystemDependencies = core . getInput ( "install-system-dependencies" ) ;
5017
5118 return install . install ( platform , architecture , release , products , cache , installSystemDependencies ) ;
5219}
0 commit comments