mirror of
https://github.com/actions/runner.git
synced 2025-12-11 12:57:05 +00:00
Null out refName
This commit is contained in:
@@ -270,6 +270,12 @@ namespace GitHub.Runner.Worker
|
||||
{
|
||||
Trace.Entering();
|
||||
|
||||
// TODO: Null out old, non-json refNames only if a FF is set.
|
||||
if (refName != null && !refName.StartsWith("{"))
|
||||
{
|
||||
refName = null;
|
||||
}
|
||||
|
||||
var child = new ExecutionContext();
|
||||
child.Initialize(HostContext);
|
||||
child.ScopeName = scopeName;
|
||||
@@ -873,7 +879,9 @@ namespace GitHub.Runner.Worker
|
||||
}
|
||||
|
||||
var newGuid = Guid.NewGuid();
|
||||
return CreateChild(newGuid, displayName, refName ?? newGuid.ToString("N"), null, null, intraActionState, _childTimelineRecordOrder - Root.PostJobSteps.Count);
|
||||
|
||||
// TODO: Check feature flag here, conditionally set refName to newGuid.ToString("N").
|
||||
return CreateChild(newGuid, displayName, refName, null, null, intraActionState, _childTimelineRecordOrder - Root.PostJobSteps.Count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,17 +6,26 @@ namespace GitHub.Runner.Worker
|
||||
{
|
||||
public static string GetRefName(this IStep step, string defaultRefName = null)
|
||||
{
|
||||
if (step is JobExtensionRunner extensionRunner && extensionRunner.RepositoryRef != null)
|
||||
// TODO: Really check a feature flag.
|
||||
if (s_featureFlagEnabled)
|
||||
{
|
||||
return JsonConvert.SerializeObject(extensionRunner.RepositoryRef);
|
||||
}
|
||||
if (step is JobExtensionRunner extensionRunner && extensionRunner.RepositoryRef != null)
|
||||
{
|
||||
return JsonConvert.SerializeObject(extensionRunner.RepositoryRef);
|
||||
}
|
||||
|
||||
if (step is IActionRunner actionRunner && actionRunner.Action?.Reference != null)
|
||||
{
|
||||
return JsonConvert.SerializeObject(actionRunner.Action.Reference);
|
||||
if (step is IActionRunner actionRunner && actionRunner.Action?.Reference != null)
|
||||
{
|
||||
return JsonConvert.SerializeObject(actionRunner.Action.Reference);
|
||||
}
|
||||
|
||||
// RefName should always be valid json or null.
|
||||
return null;
|
||||
}
|
||||
|
||||
return defaultRefName;
|
||||
}
|
||||
|
||||
private static bool s_featureFlagEnabled = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user