Update snapshot-if context and functions (#4443)

This commit is contained in:
Driele Neves Ribeiro
2026-05-21 16:49:31 -04:00
committed by GitHub
parent ae2896c551
commit 0b3b8e0ba7
3 changed files with 32 additions and 3 deletions

View File

@@ -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": {}
},

View File

@@ -2291,6 +2291,10 @@ namespace GitHub.Actions.WorkflowParser.Conversion
new NamedValueInfo<NoOperationNamedValue>(WorkflowTemplateConstants.Needs),
new NamedValueInfo<NoOperationNamedValue>(WorkflowTemplateConstants.Strategy),
new NamedValueInfo<NoOperationNamedValue>(WorkflowTemplateConstants.Matrix),
new NamedValueInfo<NoOperationNamedValue>(WorkflowTemplateConstants.Steps),
new NamedValueInfo<NoOperationNamedValue>(WorkflowTemplateConstants.Job),
new NamedValueInfo<NoOperationNamedValue>(WorkflowTemplateConstants.Runner),
new NamedValueInfo<NoOperationNamedValue>(WorkflowTemplateConstants.Env),
};
private static readonly IFunctionInfo[] s_jobConditionFunctions = new IFunctionInfo[]
{
@@ -2307,6 +2311,13 @@ namespace GitHub.Actions.WorkflowParser.Conversion
new FunctionInfo<NoOperation>(WorkflowTemplateConstants.Success, 0, 0),
new FunctionInfo<NoOperation>(WorkflowTemplateConstants.HashFiles, 1, Byte.MaxValue),
};
private static readonly IFunctionInfo[] s_snapshotConditionFunctions = null;
private static readonly IFunctionInfo[] s_snapshotConditionFunctions = new IFunctionInfo[]
{
new FunctionInfo<NoOperation>(WorkflowTemplateConstants.Always, 0, 0),
new FunctionInfo<NoOperation>(WorkflowTemplateConstants.Cancelled, 0, 0),
new FunctionInfo<NoOperation>(WorkflowTemplateConstants.Failure, 0, 0),
new FunctionInfo<NoOperation>(WorkflowTemplateConstants.Success, 0, 0),
new FunctionInfo<NoOperation>(WorkflowTemplateConstants.HashFiles, 1, Byte.MaxValue),
};
}
}

View File

@@ -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": {