Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for a new case expression function that provides conditional evaluation similar to a switch/case or if-else-if chain. The function accepts an odd number of arguments: pairs of boolean predicates and their corresponding results, plus a default value.
- Implements the
Casefunction in multiple expression namespaces (GitHub.Actions.Expressions and GitHub.DistributedTask.Expressions2) - Adds an
AllowCaseFunctionflag to control whether the case function is available in specific contexts - Includes parser-level validation to ensure the case function receives an odd number of parameters
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Sdk/Expressions/Sdk/Functions/Case.cs | New implementation of the Case function for GitHub Actions expressions |
| src/Sdk/DTExpressions2/Expressions2/Sdk/Functions/Case.cs | Duplicate Case function implementation for DistributedTask expressions |
| src/Sdk/Expressions/ExpressionConstants.cs | Registers the case function with min 3 and max 255 parameters |
| src/Sdk/DTExpressions2/Expressions2/ExpressionConstants.cs | Registers the case function in DTExpressions2 namespace |
| src/Sdk/Expressions/ParseExceptionKind.cs | Adds EvenParameters exception type for case function validation |
| src/Sdk/DTExpressions2/Expressions2/ParseExceptionKind.cs | Adds EvenParameters exception type in DTExpressions2 |
| src/Sdk/Expressions/ParseException.cs | Adds error message for even parameter count |
| src/Sdk/DTExpressions2/Expressions2/ParseException.cs | Adds error message for even parameter count in DTExpressions2 |
| src/Sdk/Expressions/ExpressionParser.cs | Adds allowCaseFunction parameter and validation logic for even parameters |
| src/Sdk/DTExpressions2/Expressions2/ExpressionParser.cs | Adds allowCaseFunction parameter and validation logic in DTExpressions2 |
| src/Sdk/WorkflowParser/ObjectTemplating/TemplateContext.cs | Adds AllowCaseFunction property defaulting to true |
| src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateContext.cs | Adds AllowCaseFunction property in DTObjectTemplating |
| src/Sdk/WorkflowParser/ObjectTemplating/Tokens/TemplateToken.cs | Passes AllowCaseFunction to expression parser in 4 evaluation methods |
| src/Sdk/DTObjectTemplating/ObjectTemplating/Tokens/TemplateToken.cs | Passes AllowCaseFunction to expression parser in 4 evaluation methods |
| src/Sdk/WorkflowParser/Conversion/WorkflowTemplateConverter.cs | Passes AllowCaseFunction when converting if conditions |
| src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs | Passes AllowCaseFunction when converting if conditions |
| src/Runner.Worker/ActionManifestManager.cs | Disables case function for action manifest parsing |
| src/Runner.Worker/ActionManifestManagerLegacy.cs | Disables case function for legacy action manifest parsing |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ericsciple
reviewed
Dec 17, 2025
| try | ||
| { | ||
| var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions); | ||
| var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions, allowCaseFunction: context.AllowCaseFunction); |
Collaborator
There was a problem hiding this comment.
is this for the evaluator? Do we hardcode to true for the evaluator?
Basically I just want to make sure we set to true for evaluation. If evaluation works E2E then 👍
Contributor
Author
There was a problem hiding this comment.
Yup, this is defaulted to true but will allow the manifest manager code paths to disable it.
ericsciple
approved these changes
Dec 17, 2025
alinetskyi
pushed a commit
to CoreumFoundation/runner
that referenced
this pull request
Jan 26, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.