from jira import JIRA, Issue, exceptions import logging def get_assignee(type, issue): isBuergerfrontend = False if type == 'Dev Backend': return 'reu9001' elif type == 'Dev Frontend': for component in issue.fields.components: isBuergerfrontend = component.name == "Bürgerfrontend" if isBuergerfrontend: return 'reu9001' return 'thh9001' elif type.startswith('Test-Anpassung'): return 'ada9001' def create_subtask(issue, parent, type, subtask_sp, estimation_remark): escaped = issue.fields.summary.replace('"', r'\"') logging.info(f'summary ~ \"{escaped}\"') try: subtask = jira_server.search_issues(f'summary ~ \"{type} {escaped}\"') if subtask: raise exceptions.JIRAError except exceptions.JIRAError: logging.info(f'Skip creating Sub-Task {type} for {issue} as it already exists') return