mirror of
https://github.com/actions/runner.git
synced 2025-12-25 10:57:32 +08:00
GitHub Actions Runner
This commit is contained in:
56
src/Sdk/DTPipelines/Pipelines/ResourceReference.cs
Normal file
56
src/Sdk/DTPipelines/Pipelines/ResourceReference.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.Pipelines
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a base set of properties common to all pipeline resource types.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public abstract class ResourceReference
|
||||
{
|
||||
protected ResourceReference()
|
||||
{
|
||||
}
|
||||
|
||||
protected ResourceReference(ResourceReference referenceToCopy)
|
||||
{
|
||||
this.Name = referenceToCopy.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the referenced resource.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
[JsonConverter(typeof(ExpressionValueJsonConverter<String>))]
|
||||
public ExpressionValue<String> Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override String ToString()
|
||||
{
|
||||
var name = this.Name;
|
||||
if (name != null)
|
||||
{
|
||||
var s = name.Literal;
|
||||
if (!String.IsNullOrEmpty(s))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
s = name.Expression;
|
||||
if (!String.IsNullOrEmpty(s))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user