使用 jira.add_comment 时未发表评论

Comment not posting when using jira.add_comment

我正在尝试用我的 Jira 开发板编写一个简单的界面,我与 basic_auth 有联系并且能够使用 jira.issue('ISSUE NAME') 检索问题但是调用 jira.add_comment(issue, "Hello World") 导致没有评论被发布到董事会。

我已确保我可以通过打印他们的正文看到关于该问题的其他评论,我能够更新其他字段,包括使用新文本的其他评论。

from jira import JIRA
import re

# By default, the client will connect to a JIRA instance started from the Atlassian Plugin SDK
# (see https://developer.atlassian.com/display/DOCS/Installing+the+Atlassian+Plugin+SDK for details).
# Override this with the options parameter.
options = {
    'server': 'https://jira.personal-server.com'}
jira = JIRA(options,basic_auth=('USER','PASS'))

# Get an issue.
issue = jira.issue('ISSUE-TITLE')

# Add a comment to the issue.
comment_a = jira.add_comment(issue,"Hello World")

我希望在 Web 界面上看到带有文本 "Hello World" 的评论,但我没有得到任何更改。

此外,一次尝试:

comment_a.update(body="HEllo?")

结果:

AttributeError: <class 'jira.resources.Comment'> object has no attribute 'self' ('Comment' object is not subscriptable)

解决方案:

JIRA 管理员正在使用自定义字段来管理评论输入,这意味着我所要做的就是找到问题并更新它。

使用字段而不是默认的 JIRA 评论 REST 方法更新评论,找到该字段并通​​过问题对象更新它。