|
25 | 25 |
|
26 | 26 | logger = logging.getLogger(__name__)
|
27 | 27 |
|
28 |
| - |
29 |
| -JIRA_DESCRIPTION_CHAR_LIMIT = 32667 |
30 |
| - |
31 | 28 | JIRA_REQUIRED_PERMISSIONS = {
|
32 | 29 | "ADD_COMMENTS",
|
33 | 30 | "CREATE_ISSUES",
|
@@ -79,7 +76,7 @@ def create_jira_issue(
|
79 | 76 | "summary": bug.summary,
|
80 | 77 | "issuetype": {"name": issue_type},
|
81 | 78 | "description": markdown_to_jira(
|
82 |
| - description, max_length=JIRA_DESCRIPTION_CHAR_LIMIT |
| 79 | + description, max_length=context.action.parameters.jira_char_limit |
83 | 80 | ),
|
84 | 81 | "project": {"key": context.jira.project},
|
85 | 82 | }
|
@@ -134,7 +131,7 @@ def add_jira_comment(self, context: ActionContext):
|
134 | 131 | prefix = f"*{commenter}* commented: \n"
|
135 | 132 | formatted_comment = prefix + markdown_to_jira(
|
136 | 133 | comment.body,
|
137 |
| - max_length=JIRA_DESCRIPTION_CHAR_LIMIT - len(prefix), |
| 134 | + max_length=context.action.parameters.jira_char_limit - len(prefix), |
138 | 135 | )
|
139 | 136 |
|
140 | 137 | issue_key = context.jira.issue
|
@@ -317,11 +314,11 @@ def update_issue_summary(self, context: ActionContext):
|
317 | 314 | """Update's an issue's summary with the description of an incoming bug"""
|
318 | 315 | truncated_summary = context.bug.summary or ""
|
319 | 316 |
|
320 |
| - if len(truncated_summary) > JIRA_DESCRIPTION_CHAR_LIMIT: |
| 317 | + if len(truncated_summary) > context.action.parameters.jira_char_limit: |
321 | 318 | # Truncate on last word.
|
322 |
| - truncated_summary = truncated_summary[:JIRA_DESCRIPTION_CHAR_LIMIT].rsplit( |
323 |
| - maxsplit=1 |
324 |
| - )[0] |
| 319 | + truncated_summary = truncated_summary[ |
| 320 | + : context.action.parameters.jira_char_limit |
| 321 | + ].rsplit(maxsplit=1)[0] |
325 | 322 |
|
326 | 323 | return self.update_issue_field(
|
327 | 324 | context, field="summary", value=truncated_summary
|
|
0 commit comments