|
15 | 15 |
|
16 | 16 | from jbi import Operation, bugzilla, environment |
17 | 17 | from jbi.common.instrument import ServiceHealth |
| 18 | +from jbi.jira.utils import markdown_to_jira |
18 | 19 | from jbi.models import ActionContext |
19 | 20 |
|
20 | 21 | from .client import JiraClient, JiraCreateError |
@@ -66,6 +67,7 @@ def check_health(self, actions: Actions) -> ServiceHealth: |
66 | 67 | and self._all_project_custom_components_exist(actions), |
67 | 68 | "all_projects_issue_types_exist": is_up |
68 | 69 | and self._all_project_issue_types_exist(actions), |
| 70 | + "pandoc_install": markdown_to_jira("- Test") == "* Test", |
69 | 71 | } |
70 | 72 | return health |
71 | 73 |
|
@@ -213,7 +215,9 @@ def create_jira_issue( |
213 | 215 | fields: dict[str, Any] = { |
214 | 216 | "summary": bug.summary, |
215 | 217 | "issuetype": {"name": issue_type}, |
216 | | - "description": description[:JIRA_DESCRIPTION_CHAR_LIMIT], |
| 218 | + "description": markdown_to_jira( |
| 219 | + description, max_length=JIRA_DESCRIPTION_CHAR_LIMIT |
| 220 | + ), |
217 | 221 | "project": {"key": context.jira.project}, |
218 | 222 | } |
219 | 223 | logger.debug( |
@@ -257,7 +261,7 @@ def add_jira_comment(self, context: ActionContext): |
257 | 261 |
|
258 | 262 | issue_key = context.jira.issue |
259 | 263 | formatted_comment = ( |
260 | | - f"*({commenter})* commented: \n{{quote}}{comment.body}{{quote}}" |
| 264 | + f"*{commenter}* commented: \n{markdown_to_jira(comment.body or "")}" |
261 | 265 | ) |
262 | 266 | jira_response = self.client.issue_add_comment( |
263 | 267 | issue_key=issue_key, |
@@ -409,7 +413,9 @@ def update_issue_summary(self, context: ActionContext): |
409 | 413 | bug.id, |
410 | 414 | extra=context.model_dump(), |
411 | 415 | ) |
412 | | - truncated_summary = (bug.summary or "")[:JIRA_DESCRIPTION_CHAR_LIMIT] |
| 416 | + truncated_summary = markdown_to_jira( |
| 417 | + bug.summary or "", max_length=JIRA_DESCRIPTION_CHAR_LIMIT |
| 418 | + ) |
413 | 419 | fields: dict[str, str] = { |
414 | 420 | "summary": truncated_summary, |
415 | 421 | } |
|
0 commit comments