mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:36:23 +00:00
17 lines
668 B
C#
17 lines
668 B
C#
using System;
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace GitHub.Runner.Common.Util
|
|
{
|
|
public static class NodeUtil
|
|
{
|
|
private const string _defaultNodeVersion = "node16";
|
|
public static readonly ReadOnlyCollection<string> BuiltInNodeVersions = new(new[] {"node12", "node16"});
|
|
public static string GetInternalNodeVersion()
|
|
{
|
|
var forcedNodeVersion = Environment.GetEnvironmentVariable(Constants.Variables.Agent.ForcedInternalNodeVersion);
|
|
return !string.IsNullOrEmpty(forcedNodeVersion) && BuiltInNodeVersions.Contains(forcedNodeVersion) ? forcedNodeVersion : _defaultNodeVersion;
|
|
}
|
|
}
|
|
}
|