Skip to content

Commit

Permalink
#405: Improved support for Azure DevOps and Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalme committed Feb 20, 2021
1 parent b0621fc commit 1350d0f
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions src/ReportGenerator.Core/Parser/FileReading/LocalFileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,18 @@ static LocalFileReader()
{
var directories = new List<string>();

// Azure Devops - Windows
if (Directory.Exists(@"D:\a\1\s"))
// Azure DevOps
if ("true".Equals(Environment.GetEnvironmentVariable("TF_BUILD"), StringComparison.OrdinalIgnoreCase)
&& Environment.GetEnvironmentVariable("Build.SourcesDirectory") != null)
{
directories.Add(@"D:\a\1\s");
directories.Add(Environment.GetEnvironmentVariable("Build.SourcesDirectory"));
}

// Azure Devops - Unix
if (Directory.Exists("/a/1/s"))
// Github Actions
if ("true".Equals(Environment.GetEnvironmentVariable("GITHUB_ACTIONS"), StringComparison.OrdinalIgnoreCase)
&& Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") != null)
{
directories.Add("/a/1/s");
}

// Github Actions - Windows
if (Directory.Exists(@"D:\a") && !Directory.Exists(@"D:\a\1\s"))
{
directories.Add(@"D:\a");
}

// Github Actions - Unix
if (Directory.Exists("/home/runner/work"))
{
directories.Add("/home/runner/work");
directories.Add(Environment.GetEnvironmentVariable("GITHUB_WORKSPACE"));
}

deterministicSourceDirectories = directories;
Expand Down

0 comments on commit 1350d0f

Please sign in to comment.