Skip to content
Merged
Prev Previous commit
Handle local actions in Node 20 deprecation warning
  • Loading branch information
salmanmkc committed Feb 19, 2026
commit 6f9dda01d7cd6cbf8f475feb54e2b1942f13ba09
11 changes: 9 additions & 2 deletions src/Runner.Worker/Handlers/HandlerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,17 @@ private static string GetActionName(Pipelines.ActionStepDefinitionReference acti
{
if (action is Pipelines.RepositoryPathReference repoRef)
Comment thread
salmanmkc marked this conversation as resolved.
{
var pathString = string.IsNullOrEmpty(repoRef.Path) ? string.Empty : $"/{repoRef.Path}";
return string.IsNullOrEmpty(repoRef.Ref)
var pathString = string.Empty;
if (!string.IsNullOrEmpty(repoRef.Path))
{
pathString = string.IsNullOrEmpty(repoRef.Name)
? repoRef.Path
: $"/{repoRef.Path}";
}
var repoString = string.IsNullOrEmpty(repoRef.Ref)
? $"{repoRef.Name}{pathString}"
: $"{repoRef.Name}{pathString}@{repoRef.Ref}";
return string.IsNullOrEmpty(repoString) ? null : repoString;
}

return null;
Expand Down
53 changes: 53 additions & 0 deletions src/Test/L0/Worker/HandlerFactoryL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,5 +317,58 @@ public void Node12Action_TrackedAsDeprecatedWhenWarnFlagEnabled()
Assert.Contains("some-org/old-action@v1", deprecatedActions);
}
}

[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void LocalNode20Action_TrackedWhenWarnFlagEnabled()
{
using (TestHostContext hc = CreateTestContext())
{
// Arrange.
var hf = new HandlerFactory();
hf.Initialize(hc);

var variables = new Dictionary<string, VariableValue>
{
{ Constants.Runner.NodeMigration.WarnOnNode20Flag, new VariableValue("true") }
};
Variables serverVariables = new(hc, variables);
var deprecatedActions = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

_ec.Setup(x => x.Global).Returns(new GlobalContext()
{
Variables = serverVariables,
EnvironmentVariables = new Dictionary<string, string>(),
DeprecatedNode20Actions = deprecatedActions
});

// Local action: Name is empty, Path is the local path
var actionRef = new RepositoryPathReference
{
Name = "",
Path = "./.github/actions/my-action",
RepositoryType = "self"
};

// Act.
var data = new NodeJSActionExecutionData();
data.NodeVersion = "node20";
hf.Create(
_ec.Object,
actionRef,
new Mock<IStepHost>().Object,
data,
new Dictionary<string, string>(),
new Dictionary<string, string>(),
new Variables(hc, new Dictionary<string, VariableValue>()),
"",
new List<JobExtensionRunner>()
);

// Assert - local action should be tracked with its path
Assert.Contains("./.github/actions/my-action", deprecatedActions);
}
}
}
}
Loading