Not allow opt-out for node20 enforcement.

This commit is contained in:
Tingluo Huang
2024-10-08 12:04:25 -04:00
parent 9b3b554758
commit ee310e18b8

View File

@@ -96,6 +96,17 @@ namespace GitHub.Runner.Worker.Handlers
var isLocalOptOut = StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable(Constants.Variables.Actions.AllowActionsUseUnsecureNodeVersion));
bool isOptOut = isWorkflowOptOutSet ? StringUtil.ConvertToBoolean(workflowOptOut) : isLocalOptOut;
if (isOptOut && (executionContext.Global.Variables.GetBoolean("DistributedTask.NotAllowOptOutForNode20") ?? false))
{
executionContext.Global.JobTelemetry.Add(new JobTelemetry()
{
Type = JobTelemetryType.General,
Message = $"Not allowing opt out for node20 in step {executionContext.Id}"
});
Trace.Info("Not allowing opt out for node20");
isOptOut = false;
}
if (!isOptOut)
{
var repoAction = action as Pipelines.RepositoryPathReference;