Action when a tag is added

Hello,

We would like to create an action when a specific tag is added to an issue. What is the best way to do that ?

Ex : tag.Released.isAdded { //Do something }

Thanks in advance

Regards

2 comments
Comment actions Permalink
Official comment

Hello,

You can check the following:

if (ctx.issue.tags.added.isNotEmpty() && ctx.issue.tags.added.has(ctx.Released))

Besides that, describe Tag in requirements:

requirements: {
Released: {
type: entities.IssueTag,
name: "Released"
}
}

 

Comment actions Permalink

Hello,

Nevermind I found a way to do it.

exports.rule = entities.Issue.onChange({
title: 'Your title',
guard: function(ctx) {
var issue = ctx.issue;
return issue.isResolved && issue.tags.added.has(ctx.Released);
},
action: function(ctx) {
//your action rule
},
requirements: {
Released: {
type: entities.IssueTag
}
}
});


Hope it can helps others.

0

Please sign in to leave a comment.