Conversation
daefa5b to
5928c4d
Compare
| /// <summary> | ||
| /// Evaluates parts of the workflow DOM. For example, a job strategy or step inputs. | ||
| /// </summary> | ||
| public interface IPipelineTemplateEvaluator |
There was a problem hiding this comment.
Enables IExecutionContext.ToPipelineTemplateEvaluator to return a wrapper
| public bool WriteDebug { get; set; } | ||
| public string InfrastructureFailureCategory { get; set; } | ||
| public JObject ContainerHookState { get; set; } | ||
| public bool HasTemplateEvaluatorMismatch { get; set; } |
There was a problem hiding this comment.
Prevents adding to telemetry multiple times. Once per job is enough.
| } | ||
| } | ||
|
|
||
| public sealed class NewAlwaysFunction : GitHub.Actions.Expressions.Sdk.Function |
There was a problem hiding this comment.
Duplicated because this needs to inherit from the new namespace
ca91081 to
90b4af4
Compare
| public static IPipelineTemplateEvaluator ToPipelineTemplateEvaluator(this IExecutionContext context, ObjectTemplating.ITraceWriter traceWriter = null) | ||
| { | ||
| // Create wrapper? | ||
| if ((context.Global.Variables.GetBoolean(Constants.Runner.Features.CompareTemplateEvaluator) ?? false) || StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("ACTIONS_RUNNER_COMPARE_TEMPLATE_EVALUATOR"))) |
There was a problem hiding this comment.
Feature flag check
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new template evaluator and related components for processing GitHub Actions workflow templates. The changes add comprehensive support for parsing, validating, and evaluating workflow YAML files with expression support, schema validation, and various token types.
Key Changes
- Implements core template evaluation infrastructure including
TemplateEvaluator,TemplateReader, andTemplateUnravelerfor processing workflow templates - Adds schema validation framework with multiple definition types (String, Number, Boolean, Mapping, Sequence, etc.)
- Introduces token system for representing template elements (BasicExpressionToken, MappingToken, SequenceToken, etc.)
Reviewed Changes
Copilot reviewed 150 out of 188 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| BasicExpressionToken.cs | Implements token type for basic expressions with evaluation and display methods |
| TemplateWriter.cs | Converts template tokens to other object formats |
| TemplateValidationException.cs | Exception class for template validation errors |
| TemplateValidationErrors.cs | Collection for managing validation errors with limits |
| TemplateValidationError.cs | Individual validation error representation |
| TemplateUnraveler.cs | Core logic for traversing and expanding template expressions |
| TemplateStrings.resx | Resource file containing localized error messages |
| TemplateStrings.cs | Auto-generated resource accessor class |
| TemplateReader.cs | Converts source objects into template tokens with validation |
| TemplateMemory.cs | Tracks memory usage during template processing |
| TemplateEvaluator.cs | Evaluates templates by expanding expressions based on context |
| TemplateContext.cs | Context object for template loading and evaluation |
| TemplateConstants.cs | Constants used throughout template processing |
| Telemetry.cs | Tracks telemetry data during workflow parsing |
| Various Schema files | Schema definitions for validating template structure |
| Various Conversion files | Workflow conversion utilities and helpers |
| Job-related files | Job and step type definitions |
| Various interface files | Interface definitions for extensibility |
| return new StringToken(m_fileId, token.Line, token.Column, str); | ||
| } | ||
|
|
||
| // Check if only ony segment |
There was a problem hiding this comment.
Corrected spelling of 'ony' to 'one'
| // Check if only ony segment | |
| // Check if only one segment |
| /// <summary> | ||
| /// Add a prefix in the error message of the given index. | ||
| /// </summary> | ||
| public void PrefixMessage(int index, String prefix) { |
There was a problem hiding this comment.
Opening brace should be on a new line to match the C# coding style used throughout this codebase.
| public void PrefixMessage(int index, String prefix) { | |
| public void PrefixMessage(int index, String prefix) | |
| { |
| public void PrefixMessage(int index, String prefix) { | ||
| if (index < 0 || index >= m_errors.Count) { |
There was a problem hiding this comment.
Opening brace should be on a new line to match the C# coding style used throughout this codebase.
| public void PrefixMessage(int index, String prefix) { | |
| if (index < 0 || index >= m_errors.Count) { | |
| public void PrefixMessage(int index, String prefix) | |
| if (index < 0 || index >= m_errors.Count) | |
| { |
| /// <summary> | ||
| /// Index and depth while replaying a YAML anchor | ||
| /// </summary> | ||
| sealed class YamlReplayState |
There was a problem hiding this comment.
Class should have an access modifier. Add 'internal' to match the pattern used in this codebase.
| sealed class YamlReplayState | |
| internal sealed class YamlReplayState |
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the credentials used for pulling the container iamge. |
There was a problem hiding this comment.
Corrected spelling of 'iamge' to 'image'
| /// Gets or sets the credentials used for pulling the container iamge. | |
| /// Gets or sets the credentials used for pulling the container image. |
| { | ||
| if (m_current is Scalar scalar) | ||
| { | ||
| // Verify not using achors |
There was a problem hiding this comment.
Corrected spelling of 'achors' to 'anchors'
| } | ||
| else if (m_current is MappingStart mappingStart) | ||
| { | ||
| // Verify not using achors |
There was a problem hiding this comment.
Corrected spelling of 'achors' to 'anchors'
| } | ||
| else if (m_current is SequenceStart sequenceStart) | ||
| { | ||
| // Verify not using achors |
There was a problem hiding this comment.
Corrected spelling of 'achors' to 'anchors'
90b4af4 to
3f4d210
Compare
Workflow used for end-to-end testing: