Skip to content

Commit 8643af4

Browse files
Improve handling of priority field in update_field_value action (#68)
1 parent 6ee14d3 commit 8643af4

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 2.5.1
4+
5+
- Improve handling of `priority` field in update_field_value action to address [#65]
6+
37
## 2.5.0
48

59
- Added multithreading in linking multiple issue functionality to speed up the response.

actions/lib/formatters.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,14 @@ def to_attachment_dict(attachment):
119119
'content': attachment.content,
120120
}
121121
return result
122+
123+
124+
def fmt_field_value(field, value):
125+
"""
126+
Returns specific field values in formats required by JIRA
127+
"""
128+
if field == "priority":
129+
value = {"name": value}
130+
if field == "labels":
131+
value = value.split()
132+
return value

actions/update_field_value.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from lib.base import BaseJiraAction
2-
from lib.formatters import to_issue_dict
2+
from lib.formatters import fmt_field_value, to_issue_dict
33

44
__all__ = [
55
'UpdateFieldValue'
@@ -9,7 +9,8 @@
99
class UpdateFieldValue(BaseJiraAction):
1010
def run(self, issue_key, field, value, notify):
1111
issue = self._client.issue(issue_key)
12-
if field == "labels":
13-
value = value.split()
14-
issue.update(fields={field: value}, notify=notify)
12+
issue.update(
13+
fields={field: fmt_field_value(field, value)},
14+
notify=notify,
15+
)
1516
return to_issue_dict(issue)

pack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords:
66
- issues
77
- ticket management
88
- project management
9-
version: 2.5.0
9+
version: 2.5.1
1010
python_versions:
1111
- "3"
1212
author : StackStorm, Inc.

0 commit comments

Comments
 (0)