mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add help links to bot messages. (#28903)
This commit is contained in:
parent
e132918b92
commit
79dcb3a3fa
1 changed files with 10 additions and 4 deletions
|
@ -261,9 +261,9 @@ class TestFailure(TestResult):
|
|||
"""
|
||||
:type args: TestConfig
|
||||
"""
|
||||
message = self.format_title()
|
||||
output = self.format_block()
|
||||
docs = self.find_docs()
|
||||
message = self.format_title(help_link=docs)
|
||||
output = self.format_block()
|
||||
|
||||
if self.messages:
|
||||
verified = all((m.confidence or 0) >= 50 for m in self.messages)
|
||||
|
@ -331,8 +331,9 @@ class TestFailure(TestResult):
|
|||
|
||||
return None
|
||||
|
||||
def format_title(self):
|
||||
def format_title(self, help_link=None):
|
||||
"""
|
||||
:type help_link: str | None
|
||||
:rtype: str
|
||||
"""
|
||||
command = self.format_command()
|
||||
|
@ -342,7 +343,12 @@ class TestFailure(TestResult):
|
|||
else:
|
||||
reason = 'error' if len(self.messages) == 1 else 'errors'
|
||||
|
||||
title = 'The test `%s` failed with the following %s:' % (command, reason)
|
||||
if help_link:
|
||||
help_link_markup = ' [[?](%s)]' % help_link
|
||||
else:
|
||||
help_link_markup = ''
|
||||
|
||||
title = 'The test `%s`%s failed with the following %s:' % (command, help_link_markup, reason)
|
||||
|
||||
return title
|
||||
|
||||
|
|
Loading…
Reference in a new issue