mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
This PR changes GITHUB_ACTION to use the step ContextName, instead of refname. The behavior is behind a feature flag. Refname is an otherwise deprecated property.
Primary motivation: For composite actions, we need a distinct GITHUB_ACTION for each nested step. This PR adds code to generate a default context name for nested steps.
For nested steps, GITHUB_ACTION will be set to "{ScopeName}.{ContextName}" to ensure no collisions.
A corresponding change will be made on the server so context name is never empty. Generated context names will start with "__".
A follow-up PR is required to avoid tracking "step" context values (outputs/conclusion/result) for generated context names. Waiting on telemetry from the server to confirm it's safe to assume leading "__" is a generate context name.
58 lines
1.7 KiB
C#
58 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Runtime.Serialization;
|
|
using GitHub.DistributedTask.ObjectTemplating.Tokens;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace GitHub.DistributedTask.Pipelines
|
|
{
|
|
[DataContract]
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
public class ActionStep : JobStep
|
|
{
|
|
[JsonConstructor]
|
|
public ActionStep()
|
|
{
|
|
}
|
|
|
|
private ActionStep(ActionStep actionToClone)
|
|
: base(actionToClone)
|
|
{
|
|
this.Reference = actionToClone.Reference?.Clone();
|
|
|
|
Environment = actionToClone.Environment?.Clone();
|
|
Inputs = actionToClone.Inputs?.Clone();
|
|
ContextName = actionToClone?.ContextName;
|
|
DisplayNameToken = actionToClone.DisplayNameToken?.Clone();
|
|
}
|
|
|
|
public override StepType Type => StepType.Action;
|
|
|
|
[DataMember]
|
|
public ActionStepDefinitionReference Reference
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
// TODO: After TFS and legacy phases/steps/ect are removed, lets replace the DisplayName in the base class with this value and remove this additional prop
|
|
[DataMember(EmitDefaultValue = false)]
|
|
public TemplateToken DisplayNameToken { get; set; }
|
|
|
|
[DataMember(EmitDefaultValue = false)]
|
|
public String ContextName { get; set; }
|
|
|
|
[DataMember(EmitDefaultValue = false)]
|
|
public TemplateToken Environment { get; set; }
|
|
|
|
[DataMember(EmitDefaultValue = false)]
|
|
public TemplateToken Inputs { get; set; }
|
|
|
|
public override Step Clone()
|
|
{
|
|
return new ActionStep(this);
|
|
}
|
|
}
|
|
}
|