From ee310e18b8fc156dbc6b462a22aa2362b8ebf44e Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Tue, 8 Oct 2024 12:04:25 -0400 Subject: [PATCH] Not allow opt-out for node20 enforcement. --- src/Runner.Worker/Handlers/HandlerFactory.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Runner.Worker/Handlers/HandlerFactory.cs b/src/Runner.Worker/Handlers/HandlerFactory.cs index f857f89a9..cbf7fa16f 100644 --- a/src/Runner.Worker/Handlers/HandlerFactory.cs +++ b/src/Runner.Worker/Handlers/HandlerFactory.cs @@ -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;