Skip to content

Commit 2013f54

Browse files
committed
Ref #91 -- Group GitHub workflow output by filename
1 parent 6eec24a commit 2013f54

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: relint/parse.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,24 @@ def split_diff_content_by_filename(output: str) -> {str: str}:
9595

9696
def print_github_actions_output(matches, args):
9797
exit_code = 0
98+
groups = collections.defaultdict(list)
9899
for filename, test, match, line_number in matches:
99100
exit_code = test.error if exit_code == 0 else exit_code
100101
start_line_no = match.string[: match.start()].count("\n") + 1
101102
end_line_no = match.string[: match.end()].count("\n") + 1
102103
col = match.start() - match.string.rfind("\n", 0, match.start())
103104
col_end = match.end() - match.string.rfind("\n", 0, match.end())
104105

105-
print(
106+
groups[filename].append(
106107
f"::{'error' if test.error else 'warning'} file={filename},"
107108
f"line={start_line_no},endLine={end_line_no},col={col},colEnd={col_end},"
108109
f"title={test.name}::{test.hint}".replace("\n", "%0A")
109110
)
111+
for filename, messages in groups.items():
112+
print(f"::group::{filename}")
113+
for annotation in messages:
114+
print(annotation)
115+
print("::endgroup::")
110116
return exit_code
111117

112118

0 commit comments

Comments
 (0)