Skip to content

Comment on related items when a stage succeeds in Azure DevOps

  • Azure DevOps
  • Automation
  • Pipelines
  • Pipeline
  • Comment

When a pipeline stage succeeds, comment on the related work items from that run in Azure DevOps.

Use the Comment on related items when a stage succeeds template in Documentero Automations. You choose which pipeline and which stage before you enable it.

Comment on related items when a stage succeeds flow overview
Flow overview: stage succeeded, then get related work items, then add a comment.

Prerequisite: Install Automations App on your Azure DevOps organization

Trigger

Trigger — Pipeline stage state changed

This step runs when a YAML stage starts or finishes. This template starts only when the stage is Completed and the result is Succeeded. Classic builds do not have stages; use Run state changed for those.

Configured in this template

  • Stage state: Completed
  • Result: Succeeded

You can customize

  • Choose the pipeline and stage this rule should watch.
  • Change the result if a different stage outcome should add the comment.
Comment on related items when a stage succeeds trigger
Stage state changed trigger set to Completed and Succeeded.
Get

Get — Get pipeline work items

Loads the work items shown as Related on the run. If that list is empty, this step reads the work items linked to the run’s changes. It uses Read pipelines and work item access, not the code repository. If those changes are not ready yet, it waits until the run finishes. Work items in another project are left out. The comment is added to these items.

You can customize

  • The comment is added to the items this Get returns. Work items in another project are not included.
Comment on related items when a stage succeeds action 1
Get pipeline work items loads the related work items for this run.
Action

Action — Add Comment

Adds a Markdown comment on the work items from Get. The sample comment names the stage, the pipeline, and a link to the run.

Configured in this template

  • Work on: Items from Get
  • Comment text: `{trigger.Pipeline.Stage} succeeded on {trigger.Pipeline.Name}. {trigger.Pipeline.Url}`

You can customize

  • Edit the Markdown comment. You can mention people or include other Smart Values from the run.
  • Keep the pipeline URL if readers should open the run from the work item.
Comment on related items when a stage succeeds action 2
Add Comment writes the stage-succeeded note on items from Get.

Full automation

Comment on related items when a stage succeeds full automation
Full builder canvas for commenting on related work items when a stage succeeds.

Common questions

How do I comment on related items when a stage succeeds in Azure DevOps?
When a pipeline stage succeeds, comment on the related work items from that run in Azure DevOps. Use the Comment on related items when a stage succeeds template in Documentero Automations: open Templates, pick this flow, choose the pipeline and stage, and enable it.
Which fields do I have to fill in before enabling this automation?
Choose the pipeline and the stage on Pipeline stage state changed. The builder blocks enable until those values are set.
What does the comment say?
The sample text is the stage name, “succeeded on”, the pipeline name, and the run URL. You can edit that Markdown before you enable the automation.
Which work items get the comment?
The work items shown as Related on the run. If that list is empty, the work items linked to the run’s changes. Work items in another project are left out.

Visual Studio Marketplace

Automations

Automate Azure DevOps workflows with triggers, actions, conditions, and scheduled rules.

Get it free