in jbi/jira/service.py [0:0]
def assign_jira_user(self, context: ActionContext, email: str):
"""Set the assignee of the specified Jira issue, raise if fails."""
issue_key = context.jira.issue
assert issue_key # Until we have more fine-grained typing of contexts
jira_user = self.find_jira_user(context, email)
jira_user_id = jira_user["accountId"]
try:
# There doesn't appear to be an easy way to verify that
# this user can be assigned to this issue, so just try
# and do it.
return self.update_issue_field(
context, "assignee", jira_user_id, wrap_value="accountId"
)
except (requests_exceptions.HTTPError, IOError) as exc:
raise ValueError(
f"Could not assign {jira_user_id} to issue {issue_key}"
) from exc