-
Notifications
You must be signed in to change notification settings - Fork 184
32 lines (28 loc) · 1.06 KB
/
close-jira-task.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Close Jira task
on:
issues:
types:
- closed
jobs:
close-jira-issue:
runs-on: ubuntu-22.04
steps:
- name: Close Jira task
id: close-jira-task
run: |-
JIRA_ID=$(curl \
--http1.1 \
-u "${JIRA_USER_EMAIL}:${JIRA_API_TOKEN}" \
${JIRA_BASE_URL}'/rest/api/latest/search?jql=summary~"sumologic-kubernetes-collection%20and%20%23${{ github.event.issue.number }}"' \
| jq '.issues[0].key' --raw-output)
curl \
--http1.1 \
-u "${JIRA_USER_EMAIL}:${JIRA_API_TOKEN}" \
"${JIRA_BASE_URL}/rest/api/latest/issue/${JIRA_ID}/transitions" \
-X POST \
-d '{"update":{"comment":[{"add":{"body":"Resolved via github actions"}}]},"transition":{"id":"31"},"fields":{"resolution":{"name":"Done"}}}' \
-H 'Content-type: application/json'
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}