Skip to content

Commit

Permalink
env
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Dec 25, 2022
1 parent ecc38d6 commit afcfee5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/Nuke.Common/CI/AzurePipelines/AzurePipelines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal AzurePipelines(Action<string> messageSink)
public string QueuedBy => EnvironmentInfo.GetVariable("BUILD_QUEUEDBY");
public Guid QueuedById => EnvironmentInfo.GetVariable<Guid>("BUILD_QUEUEDBYID");
public AzurePipelinesBuildReason BuildReason => EnvironmentInfo.GetVariable<AzurePipelinesBuildReason>("BUILD_REASON");
public bool? RepositoryClean => EnvironmentInfo.GetVariable<bool?>("BUILD_REPOSITORY_CLEAN");
public bool RepositoryClean => EnvironmentInfo.GetVariable<bool>("BUILD_REPOSITORY_CLEAN");
public string RepositoryLocalPath => EnvironmentInfo.GetVariable("BUILD_REPOSITORY_LOCALPATH");
public string RepositoryName => EnvironmentInfo.GetVariable("BUILD_REPOSITORY_NAME");

Expand Down
6 changes: 5 additions & 1 deletion source/Nuke.Utilities/EnvironmentInfo.Variables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ public static string GetVariable(string name)
[CanBeNull]
public static T GetVariable<T>(string name, char? separator = null)
{
return (T)ReflectionUtility.Convert(GetVariable(name), typeof(T), separator);
var value = GetVariable(name);
if (value == null)
return default;

return (T)ReflectionUtility.Convert(value, typeof(T), separator);
}

/// <summary>
Expand Down

0 comments on commit afcfee5

Please sign in to comment.