Skip to content

Commit 80dc4a3

Browse files
Update jira_update_field.cm (#801)
Changed jinja to correctly add ticketID to the http request. Added webhook token env variable in headers Co-authored-by: Ofer Affias <[email protected]>
1 parent 120e0e7 commit 80dc4a3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/downloads/automation-library/integrations/jira/jira_update_field.cm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ manifest:
66
on:
77
- pr_created
88

9-
{% set ticketid = "\b[A-Za-z]+-\d+\b" %}
9+
{% set ticketid = '' %}
1010
{% for ticket in tickets %}
11-
{% if (ticket | includes(regex=r/.+/)) %}
12-
{% set ticketid = ticket %}
13-
{% endif %}
14-
{% endfor %}
11+
{% if ticket and ticket | length > 0 and ticketid == '' %}
12+
{% set ticketid = ticket %}
13+
{% endif %}
14+
{% endfor %}
1515

1616
automations:
1717
jira_update_field:
@@ -22,7 +22,7 @@ automations:
2222
args:
2323
url: "{{ env.JIRA_UPDATE_PR_FIELD_WEBHOOK }}"
2424
method: POST
25-
headers: '{"Content-type": "application/json"}'
25+
headers: '{"Content-type": "application/json", "X-Automation-Webhook-Token": "{{ env.JIRA_UPDATE_PR_FIELD_SECRET }}"}'
2626
body: '{"issues":["{{ticketid}}"],"data":{"pr_url":"https://github.com/{{repo.owner}}/{{repo.name}}/pull/{{pr.number}}"}}'
2727

2828
has:

0 commit comments

Comments
 (0)