检查史诗问题是否存在,如果不存在,则创建一个新的史诗问题

Checking if epic issue exists and if not, make a new epic issue

所以问题是 IndexError,考虑到该 jql 查询不应该有任何结果,这是有道理的。

epic_search = 'project = "EXM" and type = Epic and  summary ~ "summaryx" '
esearch = jira.search_issues(epic_search)

if esearch[0].key == None:
    epic_dict = {
            'project': {'key': 'EXM'},
            'customfield_12345': 'summaryx',
            'summary': 'summaryx',
            'issuetype': {'name': 'Epic'},
        }

new_epic = jira.create_issue(fields=epic_dict)
print (new_epic.key)

有没有一种方法可以检查 jql 结果,如果为空,则创建史诗?

可能是

if (count(esearch) > 0):

我假设这是 python。我不这样做 python 但必须有类似 count() 或 esearch.length 的东西来告诉你那里有多少项目。