Try adding steps in JobExtension

This commit is contained in:
Brian Cristante
2021-10-14 16:26:00 -04:00
parent 07cda747b2
commit ec420bab24
4 changed files with 127 additions and 58 deletions

View File

@@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -9,15 +10,7 @@ namespace GitHub.Runner.Worker
// Does not recurse into the dependencies of those steps.
public static ActionDefinitionData Load(IExecutionContext executionContext, string makefile, string target)
{
var targetToFind = target + ":";
var lines = File.ReadLines(makefile);
string targetLine = lines.FirstOrDefault(line => line.TrimStart().StartsWith(targetToFind));
if (targetLine is null)
{
return null;
}
var dependencies = targetLine.Split().Skip(1).ToList();
var dependencies = ReadTargetDependencies(executionContext, makefile, target);
if (dependencies.Count == 0)
{
return null;
@@ -35,5 +28,18 @@ namespace GitHub.Runner.Worker
}
};
}
public static List<string> ReadTargetDependencies(IExecutionContext executionContext, string makefile, string target)
{
var targetToFind = target + ":";
var lines = File.ReadLines(makefile);
string targetLine = lines.FirstOrDefault(line => line.TrimStart().StartsWith(targetToFind));
if (targetLine is null)
{
return null;
}
return targetLine.Split().Skip(1).ToList();
}
}
}