Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi,
I am currently setting up some automation for our projects to copy a PR description into an issue's comment and update that same comment if the PR is edited.
So far so good when I use last or first comment, but I'd like to make it failproof by having the comment edit be based on a query result. E.g. I add AUTO-COMMENT at the top of the comment and then look for the first comment with that on an issue when time to edit.
I'm also extracting markdown from the github webhook, but can't seem to find a way to apply markdown into comments via automation, any clue on that too?
For anyone else stumbling upon this question, here is how I managed to fix my automation issue in the end
I added AUTO-PR-COMMENT at the end of the initial comment posted when a PR is Opened. You can change this text for whatever fits your liking.
Then on the "edited" condition, I added an edit comment action with a smart value for the issue. In the smart value field I put this:
{{#comments}}{{#body.endsWith("AUTO-PR-COMMENT")}}{{id}}{{/}}{{/}}
This basically means, loop over the comments. Then, for each comment, verify if the body ends with the added text. If it does, return the comment's id.
And there you have it. ;)
Dear Sebastien,
thanks for the smartvalue. In general it works great.
My situation is, that I have more than ohne comment with that Text,
so the smartvalue holds several IDs. When I than place
{{#comments}}{{#body.endsWith("AUTO-PR-COMMENT")}}{{id}}{{/}}{{/}}
into my automation to delete these comments, it does not work as this can only hold one ID at a time.
Do you have any ideas how to handle this?
Thanks in advance.
Best,
Bea
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @sebastien.devarennes -- Welcome to the Atlassian Community!
What type of markdown are you trying to use? And, have you tried the same markdown in a simpler test rule which only creates a comment?
I have noted that some of the markdown possible when entering fields like comment and description cannot be automated. Perhaps also try using HTML and the text encoding functions if you need to work-around these limitations.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well I have no control over the source format, it's a Github Pull Request description, that's markdown, plain and simple.
Since the automation comment editor has no support for Markdown, I ended up simply having the description inside a no-format code block so as to keep the essential readability of the source text.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.