From df8d8de173a37f31382ee8b059d8dfd916cf9012 Mon Sep 17 00:00:00 2001 From: eric sciple Date: Tue, 4 Aug 2020 11:12:40 -0400 Subject: [PATCH] fix feature flag check; omit context for generated context names (#638) --- src/Runner.Worker/ExecutionContext.cs | 8 ++++---- src/Runner.Worker/StepsRunner.cs | 11 +---------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/Runner.Worker/ExecutionContext.cs b/src/Runner.Worker/ExecutionContext.cs index f5211f523..18b570d33 100644 --- a/src/Runner.Worker/ExecutionContext.cs +++ b/src/Runner.Worker/ExecutionContext.cs @@ -384,8 +384,8 @@ namespace GitHub.Runner.Worker _logger.End(); - // todo: Skip if generated context name. After M271-ish the server will never send an empty context name. Generated context names will start with "__" - if (!string.IsNullOrEmpty(ContextName)) + // Skip if generated context name. Generated context names start with "__". After M271-ish the server will never send an empty context name. + if (!string.IsNullOrEmpty(ContextName) && !ContextName.StartsWith("__", StringComparison.Ordinal)) { Global.StepsContext.SetOutcome(ScopeName, ContextName, (Outcome ?? Result ?? TaskResult.Succeeded).ToActionResult()); Global.StepsContext.SetConclusion(ScopeName, ContextName, (Result ?? TaskResult.Succeeded).ToActionResult()); @@ -447,8 +447,8 @@ namespace GitHub.Runner.Worker { ArgUtil.NotNullOrEmpty(name, nameof(name)); - // todo: Skip if generated context name. After M271-ish the server will never send an empty context name. Generated context names will start with "__" - if (string.IsNullOrEmpty(ContextName)) + // Skip if generated context name. Generated context names start with "__". After M271-ish the server will never send an empty context name. + if (string.IsNullOrEmpty(ContextName) || ContextName.StartsWith("__", StringComparison.Ordinal)) { reference = null; return; diff --git a/src/Runner.Worker/StepsRunner.cs b/src/Runner.Worker/StepsRunner.cs index 40430b694..58845206b 100644 --- a/src/Runner.Worker/StepsRunner.cs +++ b/src/Runner.Worker/StepsRunner.cs @@ -104,16 +104,7 @@ namespace GitHub.Runner.Worker if (step is IActionRunner actionStep) { // Set GITHUB_ACTION - // Warning: Do not turn on FF DistributedTask.UseContextNameForGITHUBACTION until after M271-ish. After M271-ish - // the server will never send an empty context name. Generated context names start with "__" - if (step.ExecutionContext.Global.Variables.GetBoolean("DistributedTask.UseContextNameForGITHUBACTION") ?? false) - { - step.ExecutionContext.SetGitHubContext("action", actionStep.Action.Name); - } - else - { - step.ExecutionContext.SetGitHubContext("action", step.ExecutionContext.GetFullyQualifiedContextName()); - } + step.ExecutionContext.SetGitHubContext("action", actionStep.Action.Name); try {