t-bug-catcher 0.2.3__tar.gz → 0.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/PKG-INFO +1 -1
  2. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/setup.cfg +1 -1
  3. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/setup.py +1 -1
  4. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/__init__.py +1 -1
  5. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/jira.py +29 -14
  6. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher.egg-info/PKG-INFO +1 -1
  7. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/MANIFEST.in +0 -0
  8. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/README.rst +0 -0
  9. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/pyproject.toml +0 -0
  10. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/requirements.txt +0 -0
  11. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/bug_catcher.py +0 -0
  12. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/bug_snag.py +0 -0
  13. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/config.py +0 -0
  14. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/exceptions.py +0 -0
  15. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/utils/__init__.py +0 -0
  16. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/utils/common.py +0 -0
  17. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/utils/logger.py +0 -0
  18. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher/workitems.py +0 -0
  19. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
  20. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
  21. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher.egg-info/not-zip-safe +0 -0
  22. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher.egg-info/requires.txt +0 -0
  23. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/t_bug_catcher.egg-info/top_level.txt +0 -0
  24. {t_bug_catcher-0.2.3 → t_bug_catcher-0.2.5}/tests/test_t_bug_catcher.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: t_bug_catcher
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: Bug catcher
5
5
  Home-page: https://www.thoughtful.ai/
6
6
  Author: Thoughtful
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.2.3
2
+ current_version = 0.2.5
3
3
  commit = True
4
4
  tag = False
5
5
 
@@ -26,7 +26,7 @@ setup(
26
26
  packages=find_packages(include=["t_bug_catcher", "t_bug_catcher.*"]),
27
27
  test_suite="tests",
28
28
  url="https://www.thoughtful.ai/",
29
- version="0.2.3",
29
+ version="0.2.5",
30
30
  zip_safe=False,
31
31
  install_requires=install_requirements,
32
32
  )
@@ -3,7 +3,7 @@
3
3
  __author__ = """Thoughtful"""
4
4
  __email__ = "support@thoughtful.ai"
5
5
  # fmt: off
6
- __version__ = '0.2.3'
6
+ __version__ = '0.2.5'
7
7
  # fmt: on
8
8
 
9
9
  from .bug_catcher import (
@@ -216,18 +216,18 @@ class Jira:
216
216
  Returns:
217
217
  The JSON payload for creating a new issue.
218
218
  """
219
- payload = json.dumps(
220
- {
221
- "fields": {
222
- "assignee": {"id": assignee if assignee else "-1"},
223
- "description": description,
224
- "issuetype": {"id": issue_type},
225
- "project": {"key": self._project_key},
226
- "summary": summary,
227
- "labels": labels if labels else [],
228
- },
229
- }
230
- )
219
+ fields = {
220
+ "fields": {
221
+ "assignee": {"id": assignee if assignee else "-1"},
222
+ "description": description,
223
+ "issuetype": {"id": issue_type},
224
+ "project": {"key": self._project_key},
225
+ "summary": summary,
226
+ },
227
+ }
228
+ if labels:
229
+ fields["fields"]["labels"] = labels
230
+ payload = json.dumps(fields)
231
231
  return payload
232
232
 
233
233
  def move_ticket_to_board(self, ticket_id: str) -> None:
@@ -839,21 +839,36 @@ class Jira:
839
839
  Returns:
840
840
  The response from creating the ticket.
841
841
  """
842
+ issue_type = (
843
+ self._issue_types.get("bug")
844
+ or self._issue_types.get("task")
845
+ or self._issue_types.get("support", self._issue_types["epic"])
846
+ )
842
847
  issue = self.__generate_issue_body(
843
848
  summary=summary[:255].split("\n")[0],
844
849
  description=description,
845
850
  assignee=assignee_id,
846
- issue_type=self._issue_types.get("bug") or self._issue_types.get("task", "support"),
851
+ issue_type=issue_type,
847
852
  labels=labels,
848
853
  )
849
854
  response = self.post_ticket(issue=issue)
850
855
 
856
+ if response.json().get("errors", {}).get("labels"):
857
+ issue = self.__generate_issue_body(
858
+ summary=summary[:255].split("\n")[0],
859
+ description=description,
860
+ assignee=assignee_id,
861
+ issue_type=issue_type,
862
+ )
863
+ response = self.post_ticket(issue=issue)
864
+
851
865
  if response.status_code != 201:
852
866
  logger.warning(
853
867
  f"Failed to create Jira issue. Status code: {response.status_code}"
854
868
  f" Error messages: {', '.join(response.json()['errorMessages'])}"
855
869
  f" Errors: {response.json()['errors']}"
856
870
  )
871
+
857
872
  return response
858
873
 
859
874
  ticket = response.json()
@@ -1116,7 +1131,7 @@ class Jira:
1116
1131
  headers=self.__get_headers(),
1117
1132
  auth=self._auth,
1118
1133
  )
1119
- self.check_response(response)
1134
+
1120
1135
  return response
1121
1136
 
1122
1137
  def filter_tickets(self, all_tickets: List, error_id: str) -> Optional[dict]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: t_bug_catcher
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: Bug catcher
5
5
  Home-page: https://www.thoughtful.ai/
6
6
  Author: Thoughtful
File without changes
File without changes