3 Commits

Author SHA1 Message Date
Claire Kuang 5ed6ab2f69 attach warning test
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2024-02-01 17:25:12 +00:00
Claire Kuang 470b3d93de adds additional information to run failed log 2024-02-01 11:13:55 +00:00
Claire Kuang b9059e1b85 Update AutomateFunction.cs
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2024-02-01 10:20:36 +00:00
@@ -122,8 +122,19 @@ static class AutomateFunction
bool changed = !Equals(entry.Value, releaseObjectPropDict[entry.Key]);
if (changed)
{
string diff =
$"Property ({entry.Key}) changed from ({releaseObjectPropDict[entry.Key]}) to ({entry.Value})";
object? releaseValue = releaseObjectPropDict[entry.Key];
object? testValue = entry.Value;
string diff = $"Property ({entry.Key}) changed";
if (
releaseValue is not null
&& testValue is not null
&& !releaseValue.GetType().Equals(testValue.GetType())
)
{
diff +=
$" from ({releaseObjectPropDict[entry.Key]}) to ({entry.Value})";
}
if (!diffDictionary.ContainsKey(entry.Key))
{
diffDictionary.Add(entry.Key, diff);
@@ -197,7 +208,7 @@ static class AutomateFunction
if (addedList.Count + deletedList.Count + modifiedList.Count > 0)
{
automationContext.MarkRunFailed(
$"Run failed due to {addedList.Count} ADDED, {modifiedList.Count} MODIFIED, and {deletedList.Count} DELETED objects compared to the release commit."
$"Run failed due to {addedList.Count} ADDED, {modifiedList.Count} MODIFIED, and {deletedList.Count} DELETED objects compared to the release commit ({unchangedCount} objects were unchanged)."
);
addedList.ForEach(
@@ -212,6 +223,11 @@ static class AutomateFunction
$"MODIFIED object: id( {o.Item1} ), type( {o.Item2} ), changed props:( {o.Item3} )"
)
);
automationContext.AttachWarningToObjects(
MODIFIED,
modifiedList.Select(o => o.Item1).ToList()
);
}
else
{