Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of priority field in update_field_value action #68

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 2.5.1

- Improve handling of `priority` field in update_field_value action to address [#65]

## 2.5.0

- Added multithreading in linking multiple issue functionality to speed up the response.
Expand Down
11 changes: 11 additions & 0 deletions actions/lib/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,14 @@ def to_attachment_dict(attachment):
'content': attachment.content,
}
return result


def fmt_field_value(field, value):
"""
Returns specific field values in formats required by JIRA
"""
if field == "priority":
value = {"name": value}
if field == "labels":
value = value.split()
return value
9 changes: 5 additions & 4 deletions actions/update_field_value.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from lib.base import BaseJiraAction
from lib.formatters import to_issue_dict
from lib.formatters import fmt_field_value, to_issue_dict

__all__ = [
'UpdateFieldValue'
Expand All @@ -9,7 +9,8 @@
class UpdateFieldValue(BaseJiraAction):
def run(self, issue_key, field, value, notify):
issue = self._client.issue(issue_key)
if field == "labels":
value = value.split()
issue.update(fields={field: value}, notify=notify)
issue.update(
fields={field: fmt_field_value(field, value)},
notify=notify,
)
return to_issue_dict(issue)
2 changes: 1 addition & 1 deletion pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- issues
- ticket management
- project management
version: 2.5.0
version: 2.5.1
python_versions:
- "3"
author : StackStorm, Inc.
Expand Down
Loading