Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion relint/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,24 @@ def split_diff_content_by_filename(output: str) -> {str: str}:

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

print(
groups[filename].append(
f"::{'error' if test.error else 'warning'} file={filename},"
f"line={start_line_no},endLine={end_line_no},col={col},colEnd={col_end},"
f"title={test.name}::{test.hint}".replace("\n", "%0A")
)
for filename, messages in groups.items():
print(f"::group::{filename}")
for annotation in messages:
print(annotation)
print("::endgroup::")
return exit_code


Expand Down
Loading