Check last time automation rule ran

Isabel Mangan May 21, 2021

Hello,

I am creating an automation rule that is triggered by a web hook, however, I would only like to trigger it IF it has not already run this week.

Context: When we deploy our weekly release, we want to mark the lastUnreleasedVersion in Releases as Released. However, there are cases where we might release again the same week to fix a minor bug, but we don't want to have this cause the rule to mark the next version as released.

 

I feel like this should be simple to have "If this rule.lastRun < 7 days ago, then skip", but I cannot find anything like that. 

 

If that is not possible, I could also do something like "If nextUnrealedVersion.ReleaseData <= today, then execute"

Again, I was not able to find any way to do this.

 

Any help is appreciated! 

2 answers

1 vote
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 21, 2021

Hi @Isabel Mangan,

Welcome to Atlassian Community!

As you have discovered, what you are trying to do is not possible to do, since the automation cannot check its own audit log as part of a condition. I would consider doing this check on the side that is triggering the web hook if possible. What is triggering the web hook in the first place? Are you using an automation platform like tray.io?

Isabel Mangan May 21, 2021

The web hook is coming from a deploy script that we run locally.

If checking the automation audit logs is not possible, would be second idea be possible? Checking something like this: "If nextUnrealedVersion.ReleaseDate <= today, then execute"

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 21, 2021

Not from within Jira, you would have to check the release date of the version via REST API, a call to Get project versions can get the release date.

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

Hi @Isabel Mangan 

This is certainly an interesting use case... And I checked and could not find any related suggestions to it for checking the rule's own execution history.

What is in your webhook data?  Does it have one or more of the issues in the release contents?  If so, you use use the issue to check the status of the release prior to trying to release:

{{issue.fixVersion.last.released}}

Best regards,

Bill

Isabel Mangan May 21, 2021

Hi Bill,

Currently the webhook is empty and we are just triggering when we receive the webhook call. The deploy script is just a wrapper to deploy a staging branch to various clusters. I could look into sending info to use here, but couple of clarifying questions:

* Would just sending the ticket number be enough to get {{issue.fixVersion.last.released}}, or would I need to send a full issue? The thing here is just to get the ticket number would require us looking through the git commits of the branch we are releasing and looking for a ticket number

* Does {{issue.fixVersion.last.released}} return a date? And then I would check that to see if it is < 7 days old

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

Hi Isabel,

You would only need one issue key in the release.  Then you could do a branch on JQL to get the issue for that key, and then check the version information before deciding to release the version.  The available info would include: 

Available properties

  • {{issue.fixVersions.name}} - Returns the name of the fix version.
  • {{issue.fixVersions.description}} - Returns the description of the fix version.
  • {{issue.fix.Versions.archived}} - Returns true if the fix version is archived, and false if not.
  • {{issue.fixVersions.released}} - Returns true if the fix version is released, and false if not.
  • {{issue.fixVersions.releaseDate}} - Returns the fix version's release date...

 

Note in my earlier post I suggested {{issue.fixVersion.last... as I did not know if you have multiple release versions assigned to an issue.  if you don't, you may drop the last.

Isabel Mangan May 24, 2021

Hi Bill,

This seems a bit too complex for what we are looking for, so I'm just going to change to a scheduled automation and accept that the timing won't be exactly lined up with when we actually release.

Thanks for the help though! 

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer