From 0b3b8e0ba773d7e1cc554e3cd2b0ff5ed2e53277 Mon Sep 17 00:00:00 2001 From: Driele Neves Ribeiro Date: Thu, 21 May 2026 16:49:31 -0400 Subject: [PATCH] Update snapshot-if context and functions (#4443) --- src/Sdk/DTPipelines/workflow-v1.0.json | 11 ++++++++++- .../Conversion/WorkflowTemplateConverter.cs | 13 ++++++++++++- src/Sdk/WorkflowParser/workflow-v1.0.json | 11 ++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/Sdk/DTPipelines/workflow-v1.0.json b/src/Sdk/DTPipelines/workflow-v1.0.json index 432cb75ec..c51b9f66e 100644 --- a/src/Sdk/DTPipelines/workflow-v1.0.json +++ b/src/Sdk/DTPipelines/workflow-v1.0.json @@ -186,7 +186,16 @@ "vars", "needs", "strategy", - "matrix" + "matrix", + "steps", + "job", + "runner", + "env", + "always(0,0)", + "failure(0,0)", + "cancelled(0,0)", + "success(0,0)", + "hashFiles(1,255)" ], "string": {} }, diff --git a/src/Sdk/WorkflowParser/Conversion/WorkflowTemplateConverter.cs b/src/Sdk/WorkflowParser/Conversion/WorkflowTemplateConverter.cs index 9a7a4d0fc..df80774d3 100644 --- a/src/Sdk/WorkflowParser/Conversion/WorkflowTemplateConverter.cs +++ b/src/Sdk/WorkflowParser/Conversion/WorkflowTemplateConverter.cs @@ -2291,6 +2291,10 @@ namespace GitHub.Actions.WorkflowParser.Conversion new NamedValueInfo(WorkflowTemplateConstants.Needs), new NamedValueInfo(WorkflowTemplateConstants.Strategy), new NamedValueInfo(WorkflowTemplateConstants.Matrix), + new NamedValueInfo(WorkflowTemplateConstants.Steps), + new NamedValueInfo(WorkflowTemplateConstants.Job), + new NamedValueInfo(WorkflowTemplateConstants.Runner), + new NamedValueInfo(WorkflowTemplateConstants.Env), }; private static readonly IFunctionInfo[] s_jobConditionFunctions = new IFunctionInfo[] { @@ -2307,6 +2311,13 @@ namespace GitHub.Actions.WorkflowParser.Conversion new FunctionInfo(WorkflowTemplateConstants.Success, 0, 0), new FunctionInfo(WorkflowTemplateConstants.HashFiles, 1, Byte.MaxValue), }; - private static readonly IFunctionInfo[] s_snapshotConditionFunctions = null; + private static readonly IFunctionInfo[] s_snapshotConditionFunctions = new IFunctionInfo[] + { + new FunctionInfo(WorkflowTemplateConstants.Always, 0, 0), + new FunctionInfo(WorkflowTemplateConstants.Cancelled, 0, 0), + new FunctionInfo(WorkflowTemplateConstants.Failure, 0, 0), + new FunctionInfo(WorkflowTemplateConstants.Success, 0, 0), + new FunctionInfo(WorkflowTemplateConstants.HashFiles, 1, Byte.MaxValue), + }; } } diff --git a/src/Sdk/WorkflowParser/workflow-v1.0.json b/src/Sdk/WorkflowParser/workflow-v1.0.json index ff2d3185d..bfef51ce7 100644 --- a/src/Sdk/WorkflowParser/workflow-v1.0.json +++ b/src/Sdk/WorkflowParser/workflow-v1.0.json @@ -2196,7 +2196,16 @@ "vars", "needs", "strategy", - "matrix" + "matrix", + "steps", + "job", + "runner", + "env", + "always(0,0)", + "failure(0,0)", + "cancelled(0,0)", + "success(0,0)", + "hashFiles(1,255)" ], "description": "Use the if conditional to prevent a snapshot from being taken unless a condition is met. Any supported context and expression can be used to create a conditional. Expressions in an `if` conditional do not require the bracketed expression syntax. When you use expressions in an `if` conditional, you may omit the expression syntax because GitHub automatically evaluates the `if` conditional as an expression.", "string": {