Skip to content

Commit

Permalink
chore: close jira if issue is closed (#1586)
Browse files Browse the repository at this point in the history
Tested on Sumo Logic Kubernetes Collection

Signed-off-by: Dominik Rosiek <drosiek@sumologic.com>
  • Loading branch information
sumo-drosiek authored May 17, 2024
1 parent baac6cf commit 023b0e5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/close-jira-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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-otel-collector%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 }}

0 comments on commit 023b0e5

Please sign in to comment.