Change (add|update)_field_value actions return type. Fix update_field_value when field is 'labels'. #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are some cases where
labelsmay not be an attribute of if an issue as one st2 user pointed out in Jira pack : Python error AttributeError: 'PropertyHolder' object has no attribute 'labels' #53 . Two actions,add_field_valueandupdate_field_valuereturnedissue.fields.labels(list) regardless of which field was being updated which seems a bit counter-intuitive to someone updating something like the description or summary fields of an issue. We now return a dictionary representation of an issue when running these actions as we do in other actions such ascreate_issuefor consistency. The dictionary that is returned includeslabelsif they exist. This may be a breaking change for any users that are expecting the result from these two actions to be a list of labels instead of a dictionary that includes labels as a key.The
update_field_valueaction is unable to update thelabelsfield because the JIRA API expects these to be posted as a list instead of a string. This is discussed in Add support for general api token #54 . We modify the action code to split thevalueparameter ofupdate_field_valueso it becomes a list only in the case wherefieldis equal to"labels". Example invocation to illustrate how this works:This updates the issue being modified so its
labelsfield becomes: