Release automation rule doesn't work when a release is made via Rest API
Asked by Ismaeil Ghouneim:

We have an Automation Rule that typically triggers when a release gets released. However, I'm automating this process in the sense that, a github workflow creates the release and releases it using \`[https://\*\*\*.atlassian.net/rest/api/3/version](https://justeattakeaway.atlassian.net/rest/api/3/version)\` and for some reason, this doesn't trigger the Automation Rule.

Why is that? Shouldn't the automation rule be executed whenever a release gets created regardless of whether it was made manually through JIRA UI or the RestAPI?


Answers:
author: Bill Sheboy
body: Hi [@Ismaeil Ghouneim](/t5/user/viewprofilepage/user-id/5541547) -- Welcome to the Atlassian Community!

To confirm, is this the Jira REST API endpoint you are using:

<https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-version-post>

Did you confirm the version was created successfully in the project?

Is your automation rule defined / scoped in the same project where the version was created?

As an experiment in *one single Jira project*, I used one automation rule to call the REST API to create a version and a second one to detect that a version was created, and both worked as expected.

Kind regards,  
Bill

comments: author: Ismaeil Ghouneim
body: Thanks for answering Bill.

Pretty much yes, the release gets created successfully using this mentioned REST API and the rule is defined in the same project (that's why it works fine when the release is created via the UI). But the rule doesn't execute. I even had a look at the Audit Log and it's not there.

I even now tried using cURL directly to create the release via the API and it does the same behaviour, creates the release no problem but the trigger never gets executed.

```
FIX_VERSION="****"
CREATE_PAYLOAD="{\"name\":\"***\",\"project\":\"***\",\"releaseDate\":\"$(date +%F)\",\"released\": true}"
curl -X POST -v -H "Content-Type: application/json" -u "jira_token" -d "${CREATE_PAYLOAD}" https://******.atlassian.net/rest/api/3/version
```

```
?
```


author: Bill Sheboy
body: I just tried using Postman and the version create was correctly detected to trigger a rule, so it does not seem to an active problem / incident. Perhaps try the same thing as that would eliminate an issue with your call.


author: Ismaeil Ghouneim
body: Aha! For anyone interested, I figured out what the issue was.

The order of my workflow execution was as follows:

1. Create a version using POST with \`released: true\`
2. Associate any ticket with that fix version

Apparently for JIRA, this creates an-already-released version which for some reason doesn't make the automation rule detect it. You see the trigger here basically works **when an unreleased version is released**. In short, the automation rule is triggered by the PUT method.

The order of execution that makes it work:

1. Create a version using POST with \`released: false\`
2. Associate tickets .. whatever
3. Update the version using PUT (by version id) with \`released: true\`


author: Bill Sheboy
body: That is interesting...I tried both: released: false and true.

As long has you have it working now, that is great!


Tags: cloud

jira-cloud