mirror of
https://github.com/actions/runner.git
synced 2025-12-11 21:06:55 +00:00
Created env var for forcing node12 actions to run on node16 (#1913)
* Created env var for forcing node12 actions to run on node16 * get value of hostContext environment variable * changing location of forced node version check * small code refactoring Co-authored-by: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> * more of small code refactoring Co-authored-by: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> * refactoring of conditions for getting internal node version * changing expected value for node version env var * Adding empty line between two methods * Created method GetNodeVersion * GetNodeVersion from function to inline call and PR fixes Co-authored-by: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com>
This commit is contained in:
@@ -15,8 +15,14 @@ namespace GitHub.Runner.Common.Util
|
||||
|
||||
public static string GetInternalNodeVersion()
|
||||
{
|
||||
var forcedNodeVersion = Environment.GetEnvironmentVariable(Constants.Variables.Agent.ForcedInternalNodeVersion);
|
||||
return !string.IsNullOrEmpty(forcedNodeVersion) && BuiltInNodeVersions.Contains(forcedNodeVersion) ? forcedNodeVersion : _defaultNodeVersion;
|
||||
var forcedInternalNodeVersion = Environment.GetEnvironmentVariable(Constants.Variables.Agent.ForcedInternalNodeVersion);
|
||||
var isForcedInternalNodeVersion = !string.IsNullOrEmpty(forcedInternalNodeVersion) && BuiltInNodeVersions.Contains(forcedInternalNodeVersion);
|
||||
|
||||
if (isForcedInternalNodeVersion)
|
||||
{
|
||||
return forcedInternalNodeVersion;
|
||||
}
|
||||
return _defaultNodeVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user