mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
Pass fileID to all children token of root action token
This commit is contained in:
@@ -70,7 +70,8 @@ namespace GitHub.Runner.Worker
|
||||
var fileContent = File.ReadAllText(manifestFile);
|
||||
using (var stringReader = new StringReader(fileContent))
|
||||
{
|
||||
var yamlObjectReader = new YamlObjectReader(null, stringReader);
|
||||
// Does setting fileID will help for token to return correct fileerror.
|
||||
var yamlObjectReader = new YamlObjectReader(fileId, stringReader);
|
||||
token = TemplateReader.Read(context, "action-root", yamlObjectReader, fileId, out _);
|
||||
}
|
||||
|
||||
@@ -418,15 +419,9 @@ namespace GitHub.Runner.Worker
|
||||
case "steps":
|
||||
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TESTING_COMPOSITE_ACTIONS_ALPHA")))
|
||||
{
|
||||
Trace.Info($"COMPOSITE ACTIONS FILEID inside steps case: {fileID}");
|
||||
Trace.Info($"COMPOSITE ACTIONS file name inside steps case {context.GetFileName(fileID)}");
|
||||
// File name is loaded correctly!!
|
||||
// WHY DOESN'T THE CONTEXT GET PASED DOWN CORRECTLY?
|
||||
var steps = run.Value.AssertSequence("steps");
|
||||
var evaluator = executionContext.ToPipelineTemplateEvaluator();
|
||||
// stepsLoaded = evaluator.LoadCompositeSteps(steps, context.GetFileTable(), fileID);
|
||||
string fileName = context.GetFileName(fileID);
|
||||
stepsLoaded = evaluator.LoadCompositeSteps(steps, fileName);
|
||||
stepsLoaded = evaluator.LoadCompositeSteps(steps, context.GetFileTable());
|
||||
break;
|
||||
}
|
||||
throw new Exception("You aren't supposed to be using Composite Actions yet!");
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using GitHub.DistributedTask.ObjectTemplating.Tokens;
|
||||
using GitHub.DistributedTask.Pipelines.ContextData;
|
||||
using GitHub.DistributedTask.WebApi;
|
||||
using GitHub.Runner.Common;
|
||||
using GitHub.Runner.Sdk;
|
||||
using GitHub.DistributedTask.WebApi;
|
||||
using Pipelines = GitHub.DistributedTask.Pipelines;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using GitHub.DistributedTask.ObjectTemplating.Tokens;
|
||||
using System.Collections.Generic;
|
||||
using GitHub.DistributedTask.Pipelines.ContextData;
|
||||
|
||||
|
||||
namespace GitHub.Runner.Worker.Handlers
|
||||
{
|
||||
|
||||
@@ -137,11 +137,9 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
||||
Int32? fileId,
|
||||
Int32? line,
|
||||
Int32? column,
|
||||
Exception ex,
|
||||
String fileName = default(string))
|
||||
Exception ex)
|
||||
{
|
||||
TraceWriter.Info($"Error fileId: {fileId}");
|
||||
var prefix = GetErrorPrefix(fileId, line, column, fileName: fileName);
|
||||
var prefix = GetErrorPrefix(fileId, line, column);
|
||||
Errors.Add(prefix, ex);
|
||||
TraceWriter.Error(prefix, ex);
|
||||
}
|
||||
@@ -205,16 +203,9 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
||||
private String GetErrorPrefix(
|
||||
Int32? fileId,
|
||||
Int32? line,
|
||||
Int32? column,
|
||||
string fileName = default(string))
|
||||
Int32? column)
|
||||
{
|
||||
TraceWriter.Info($"GetErrorPrefix FileID: {fileId}");
|
||||
|
||||
// if (String.IsNullOrEmpty(fileName)) {
|
||||
// fileName = fileId.HasValue ? GetFileName(fileId.Value) : null;
|
||||
// }
|
||||
// var fileName = fileId.HasValue ? GetFileName(fileId.Value) : null;
|
||||
fileName = "TESTING";
|
||||
var fileName = fileId.HasValue ? GetFileName(fileId.Value) : null;
|
||||
if (!String.IsNullOrEmpty(fileName))
|
||||
{
|
||||
if (line != null && column != null)
|
||||
|
||||
@@ -28,11 +28,9 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
||||
TemplateToken template,
|
||||
Int32 removeBytes,
|
||||
Int32? fileId,
|
||||
Boolean omitHeader = false,
|
||||
String fileName = default(string))
|
||||
Boolean omitHeader = false)
|
||||
{
|
||||
TemplateToken result;
|
||||
context.TraceWriter.Info("I'm in Evaluate!");
|
||||
if (!omitHeader)
|
||||
{
|
||||
if (fileId != null)
|
||||
@@ -68,7 +66,7 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
context.Error(fileId, null, null, ex, fileName: fileName);
|
||||
context.Error(fileId, null, null, ex);
|
||||
result = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,33 +159,24 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
||||
return result;
|
||||
}
|
||||
|
||||
// public List<ActionStep> LoadCompositeSteps(
|
||||
// TemplateToken token,
|
||||
// IReadOnlyList<String> fileTable,
|
||||
// Int32 fileID)
|
||||
// {
|
||||
public List<ActionStep> LoadCompositeSteps(
|
||||
TemplateToken token,
|
||||
String fileName)
|
||||
IReadOnlyList<String> fileTable)
|
||||
{
|
||||
// HOW DO WE LOG INFORMATION IN THIS FILE??????
|
||||
var result = default(List<ActionStep>);
|
||||
if (token != null && token.Type != TokenType.Null)
|
||||
{
|
||||
// Create New Context Object
|
||||
var context = CreateContext(null, null, setMissingContext: false);
|
||||
|
||||
// Pass original filetable to the context:
|
||||
// foreach (var f in fileTable) {
|
||||
// context.GetFileId(f);
|
||||
// }
|
||||
// Pass original filetable to the new context:
|
||||
foreach (var f in fileTable) {
|
||||
context.GetFileId(f);
|
||||
}
|
||||
|
||||
// TODO: we might want to to have a bool to prevent it from filling in with missing context w/ dummy variables
|
||||
|
||||
// TODO: context does not have the fileTable associated with it!!!
|
||||
try
|
||||
{
|
||||
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.StepsInTemplate, token, 0, null, omitHeader: false, fileName: fileName);
|
||||
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.StepsInTemplate, token, 0, null, omitHeader: false);
|
||||
context.Errors.Check();
|
||||
result = PipelineTemplateConverter.ConvertToSteps(context, token);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user