https://discord.umbraco.com logo
Can anyone offer some help. I've worked
# package-development
o
Can anyone offer some help. I've worked the Umbraco.Automate repo, made some changes and then packaged up the code to make a local nuget package so that I can install it in to a test site but never works, test site fails to load. First question, is this the correct way to test or am I going about this the wrong way? Is there a more obvious way to test the changes
m
Well that's the way I go.. (belt and braces might be) - first check runs in the repo as a project dependency against a test site) - test against a local nuget pacakge - test against a github released package (internal not public) - test against a prerelease package on nuget.org for the local test I have this for packing from Visual Studio, right click project pack, or set pack on build true..
Copy code
<!-- when packing via IDE have debug store elsewhere and version stamp with date for ease-->
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <PackageOutputPath>$(MSBuildThisFileDirectory)..\..\dist\</PackageOutputPath>
    <VersionSuffix>dev</VersionSuffix>
    <VersionPrefix>$([System.DateTime]::Now.ToString("yyyy.MM.dd.HHmm"))</VersionPrefix>
  </PropertyGroup>
then use psw to spin up the test site with local package
#dotnet add "$project" package {package_name} --source "D:\_work\{...}\dist" --prerelease
You can also set as a source (but don't need to).. but could do to get package manager ide to find you local packages.
dotnet nuget add source "d:\_work\{...}\dist" --name "LocalPackages"
I hope that's not telling you to suck eggs.. 🙂 beyond that what's your error? do you see the correct dependency added in the ide?
forgot to say you can use nuget package explorer to make sure your package looks correct internally.. (or just unzip) https://github.com/NuGetPackageExplorer/NuGetPackageExplorer
o
Cheers Mike. I'll maybe take another stab at it later
and if I get errors I'll share
s
Are you fixing the field group labels? 🏷️ if you define a group on a [field]. It spits out gobbledegook ‘technical term’
o
na, I'm trying to add an option to only trigger on publish once. So if you republish a page, it doesnt trigger again
s
Ahh, I attempted to work around that, by having a step that updates the node with a Boolean flag. So you can’t re-run it again if it’s been set to ‘true’
@Owain You have probably seen it, but is this any use ? ${ trigger.isNew } https://docs.umbraco.com/umbraco-automate/concepts/triggers#trigger-output
o
oh, I havent. Nice. I'll test.
Hmm, doesnt exist on Content Published,
s
Well, that seems as useful as a choco-teapot
m
object? GetValue(string propertyTypeAlias, string? culture = null, string? segment = null, bool published = false);
https://github.com/umbraco/Umbraco-CMS/blob/main/src/Umbraco.Core/Models/ContentBase.cs could you use the published flag to compare before and after to see if the published property changed? could also be the case that published = true, for a node that doesn't currently have a published version returns null? or
IsPropertyDirty
on the published value 🫣
w
Whats the goal you want to do Owain? * Run once and only once for the first Publish * Run again if any of the properties/content changed
m
Could also be.. moving from unpublished to published triggers (over just the first publish)
w
Also back to your original question if you are doing this in order to test your work as a PR to give back then the repo has some slash command /skill to setup a demo site from memory
o
Currently totally borked my setup so might go back to the start 😄
@User - trigger run once if it's first publish of the node, done trigger again if a second publish is done for that node. Example, write a blog, publish it. hit all automation points. Notice a spelling mistake, republish (don't want to fire all my automation again at this point)
w
In that case think the best suggestion that others have advised is to use a prop that will set it to true once automations have run on it (Update content step) Then next time you publish your spelling mistake you can exit out early or stop if that bool present
So a get content step after your save & publish one to lookup that value
o
so don't add it as a trigger option in code? Just make Automate change a toggle?
w
Hang on let me try one
Untested especially around how it would get the bool value out. Is it a string of 0/1 or a string of true/false or... - but this is what I would try and do https://cdn.discordapp.com/attachments/1519239103604981812/1519367101071097958/Screen_Recording_2026-06-24_at_16.36.05.mp4?ex=6a3d4c61&is=6a3bfae1&hm=9b2a9b13873cc8cecc73d2c43d6c07a43116045769358f9ce64ee4d68dd17ae8&
o
That was a great help. Got it working now 😄
Set the toggle to 1
no code changes needed 😄
w
Ace stuff
And if you ever need to re-run the automation. Set the prop back to false and next time you publish it can re-run
o
yip, works a treat.
Thanks. I was trying to do stuff by changing the binding keys and stuff and getting all mixed up.
w
No worries glad I could help
o
Funny thing was - I could hear your voice in my head when moving the mouse about pointing at stuff 😄
w
Did my rambling not come out on the video?
o
oh, I didnt have my headphones on 😄
w
That or you just didn't wanna listen to me
o
Never 😄
w
haha yeh yeh 😛
s
Yay! That’s how I got it working too - just had a flag switching the node property to true. Also means you can set it back to ‘false’ to refire if required.
o
Going to blog about it later
w
Feel free to use my ramblings if it’s any use
@suedeapple (Paul) what you doing with your automations?
s
I did exactly the same trick as you in your videos. I thought it was a "bodge", as it means adding a property to the doctype. However I decided to have an Composition for "automate", that nodes can inherit from, for "lastRun", "lastRunDate". As at the moment it's hard to determine which nodes have been touched by an automate worflow. (unless you use the OOTB logger)
w
Potential idea to update the content references to a node if its used in a Automation perhaps or a workspace view 🤔
s
Yeah, something in the node info panel, like we have for "references", Otherwise, editors wont realise that publishing a node may trigger a massive Workflow. https://cdn.discordapp.com/attachments/1519239103604981812/1519444993138491453/image.png?ex=6a3d94ec&is=6a3c436c&hm=322efc87f8ae358a9d2a6ff4748b0b84e2153d4404357b6fe6bb9e169afc5fb8&
3 Views