Skip to content

Commit d74254f

Browse files
authored
Merge pull request #5 from mongodb/chore_add_jira_transition
chore: add jira transition
2 parents 3928493 + 585e319 commit d74254f

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

transition-jira/action.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'Transition Jira Issue'
2+
description: 'Transition Jira Issue'
3+
inputs:
4+
token:
5+
description: "Token to connect to Jira"
6+
required: true
7+
issue-key:
8+
description: "Issue Key"
9+
required: true
10+
transition-id:
11+
description: "Id of Transition"
12+
required: true
13+
resolution:
14+
description: "Resolution of Transition"
15+
runs:
16+
using: "composite"
17+
steps:
18+
- id: find
19+
shell: bash
20+
env:
21+
JIRA_API_TOKEN: ${{ inputs.token }}
22+
ISSUE_KEY: ${{ inputs.issue-key }}
23+
TRANSITION_ID: ${{ inputs.transition-id }}
24+
RESOLUTION: ${{ inputs.resolution }}
25+
run: |
26+
request=$(jq -n --arg transition_id "$TRANSITION_ID" '{"transition":{"id":$transition_id}}')
27+
if [[ -n "$RESOLUTION" ]]; then
28+
request=$(echo $request | jq --arg resolution "$RESOLUTION" '[.,{fields:{resolution:{name:$resolution}}}] | add')
29+
fi
30+
echo "REQUEST=${request}"
31+
json_response=$(curl --request POST \
32+
--url "https://jira.mongodb.org/rest/api/2/issue/$ISSUE_KEY/transitions" \
33+
--header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \
34+
--header 'Accept: application/json' \
35+
--header 'Content-Type: application/json' \
36+
--data "$request" \
37+
-v)
38+
echo "RESPONSE=${json_response}"

0 commit comments

Comments
 (0)