Hi all,
I have a GitHub action to trigger releasing a version in Jira. I send the version name with the webhook data, {{webhookData.version}} returns ABC.
In my rule for the Jira automation, I send a Slack message if there are issues not ready for release. Something like "Version ABC is not ready to be released". I would like to embed the Jira link of the to-be-released version in ABC text. For that, I would need the version ID. For example, in the release version link below the ID is 12345.
https://project.atlassian.net/projects/WEB/versions/12345/tab/release-report-all-issues
Is there a JQL that helps me get this ID when I only know the version name from webhookData
I have given this a go myself and have got it working
As you say, the URL of the Fix Version is built up using the version's ID. so you will need to use {{webResponse.body.fields.fixVersions.id}} to get this. If you wanted the rule to run agnostic of the project it's running from, you can also use {{webResponse.body.fields.project.key}}, otherwise you can not include this and just hard-code the project's key in it's place. So the URL to send to users would look a little something like this:
https://[your_site_name].atlassian.net/projects/{{webResponse.body.fields.project.key}}/versions/{{webResponse.body.fields.fixVersions.id}}/tab/release-report-all-issues
As you are using automation rules, you could extend this further by embedding this URL within some text, using a format of <[url_generated]|[text to show the user in Slack]> such as the below:
<https://[your_site_name].atlassian.net/projects/{{webResponse.body.fields.project.key}}/versions/{{webResponse.body.fields.fixVersions.id}}/tab/release-report-all-issues|click here> to view the release
Which would look like this, and the link will take you to the link of the release you have specified.
Hope this helps!
Hi, thanks for your fast response!
For now, what I did to solve this is that I used the API request in the backend code to get all project's versions, and then looked for the right version object by name, and then got the ID of the version from that object. Afterward, I sent the version name and id in the {{webhookData}}. Then in my rules, I can use {{webhookData.version_id}} to get the ID. The screenshot below is what the rules look like right now.
I works but.. long lines of code just to get the version ID. So I'm wondering if there is an API call or a query that I can use directly in the rules to help me get the version ID if I only know the version name.
but as I understood from your answer, you sent an API request in your rules to get your {{webResponse}}, right? What exactly did your request do and how did the URL look?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kim Ngan Le Dang I just used an automation rule action to send an empty web request to
https://[my-site-name].atlassian.net/rest/api/latest/issue/ABC-1
So this was just a simple GET request which retrieves the issue data, with some basic auth, and then I used the response to grab the version ID and name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh thank you very much!! This is very helpful. I realize that I can get the version ID using the lookupIssues in the request url
https://[my-site-name].atlassian.net/rest/api/issue/{{lookupIssues.first.key}}
and the retrieve id from {{webResponse.body.fields.fixVersions.id}} as you suggest in the previous reply.
It worked!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries, glad you've got it working! :-)
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.