diff --git a/src/Runner.Common/Constants.cs b/src/Runner.Common/Constants.cs index dfb50ff4f6b..e374f36740e 100644 --- a/src/Runner.Common/Constants.cs +++ b/src/Runner.Common/Constants.cs @@ -171,7 +171,6 @@ public static class Features public static readonly string UnsupportedStopCommandTokenDisabled = "You cannot use a endToken that is an empty string, the string 'pause-logging', or another workflow command. For more information see: https://docs.github.com/actions/learn-github-actions/workflow-commands-for-github-actions#example-stopping-and-starting-workflow-commands or opt into insecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_STOPCOMMAND_TOKENS` environment variable to `true`."; public static readonly string UnsupportedSummarySize = "$GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of {0}k, got {1}k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary"; public static readonly string SummaryUploadError = "$GITHUB_STEP_SUMMARY upload aborted, an error occurred when uploading the summary. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary"; - public static readonly string Node12DetectedAfterEndOfLife = "Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: {0}. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/."; public static readonly string EnforcedNode12DetectedAfterEndOfLife = "The following actions uses node12 which is deprecated and will be forced to run on node16: {0}. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/"; public static readonly string EnforcedNode12DetectedAfterEndOfLifeEnvVariable = "Node16ForceActionsWarnings"; } diff --git a/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs b/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs index 4f701d7cd93..986cf6b11fa 100644 --- a/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs +++ b/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs @@ -136,29 +136,6 @@ public async Task RunAsync(ActionRunStage stage) // Remove environment variable that may cause conflicts with the node within the runner. Environment.Remove("NODE_ICU_DATA"); // https://github.com/actions/runner/issues/795 - if (Data.NodeVersion == "node16" && (ExecutionContext.Global.Variables.GetBoolean(Constants.Runner.Features.Node16Warning) ?? false)) - { - var repoAction = Action as RepositoryPathReference; - var warningActions = new HashSet(); - if (ExecutionContext.Global.Variables.TryGetValue("Node16ActionsWarnings", out var node16Warnings)) - { - warningActions = StringUtil.ConvertFromJson>(node16Warnings); - } - - var repoActionFullName = ""; - if (string.IsNullOrEmpty(repoAction.Name)) - { - repoActionFullName = repoAction.Path; // local actions don't have a 'Name' - } - else - { - repoActionFullName = $"{repoAction.Name}/{repoAction.Path ?? string.Empty}".TrimEnd('/') + $"@{repoAction.Ref}"; - } - - warningActions.Add(repoActionFullName); - ExecutionContext.Global.Variables.Set("Node16ActionsWarnings", StringUtil.ConvertToJson(warningActions)); - } - using (var stdoutManager = new OutputManager(ExecutionContext, ActionCommandManager)) using (var stderrManager = new OutputManager(ExecutionContext, ActionCommandManager)) { diff --git a/src/Runner.Worker/JobRunner.cs b/src/Runner.Worker/JobRunner.cs index 45a035e8fd2..5e50fd6809f 100644 --- a/src/Runner.Worker/JobRunner.cs +++ b/src/Runner.Worker/JobRunner.cs @@ -269,10 +269,10 @@ private async Task CompleteJobAsync(IRunServer runServer, IExecution { jobContext.Debug($"Finishing: {message.JobDisplayName}"); TaskResult result = jobContext.Complete(taskResult); - if (jobContext.Global.Variables.TryGetValue("Node12ActionsWarnings", out var node12Warnings)) + if (jobContext.Global.Variables.TryGetValue(Constants.Runner.EnforcedNode12DetectedAfterEndOfLifeEnvVariable, out var node16ForceWarnings)) { - var actions = string.Join(", ", StringUtil.ConvertFromJson>(node12Warnings)); - jobContext.Warning(string.Format(Constants.Runner.Node12DetectedAfterEndOfLife, actions)); + var actions = string.Join(", ", StringUtil.ConvertFromJson>(node16ForceWarnings)); + jobContext.Warning(string.Format(Constants.Runner.EnforcedNode12DetectedAfterEndOfLife, actions)); } // Make sure to clean temp after file upload since they may be pending fileupload still use the TEMP dir. @@ -368,12 +368,6 @@ private async Task CompleteJobAsync(IJobServer jobServer, IExecution } } - if (jobContext.Global.Variables.TryGetValue("Node12ActionsWarnings", out var node12Warnings)) - { - var actions = string.Join(", ", StringUtil.ConvertFromJson>(node12Warnings)); - jobContext.Warning(string.Format(Constants.Runner.Node12DetectedAfterEndOfLife, actions)); - } - if (jobContext.Global.Variables.TryGetValue(Constants.Runner.EnforcedNode12DetectedAfterEndOfLifeEnvVariable, out var node16ForceWarnings)) { var actions = string.Join(", ", StringUtil.ConvertFromJson>(node16ForceWarnings));