Skip to content

Commit

Permalink
ci(scripts/detect_errors): try to show info messages in a way github …
Browse files Browse the repository at this point in the history
…understands (#6493)

I don't actually know if this works, but I know that the previous code was not working:

https://github.com/leanprover-community/mathlib/pull/6485/checks?check_run_id=2006396264#step:7:7



Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
  • Loading branch information
eric-wieser and bryangingechen committed Mar 1, 2021
1 parent 0a5f69c commit 0334475
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/detect_errors.py
Expand Up @@ -10,11 +10,19 @@ def encode_msg_text_for_github(msg):

def format_msg(msg):
# Formatted for https://github.com/actions/toolkit/blob/master/docs/commands.md#log-level

# mapping between lean severity levels and github levels.
# github does not support info levels, which are emitted by `#check` etc:
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-debug-message
severity_map = {'information': 'warning'}
severity = msg.get('severity')
severity = severity_map.get(severity, severity)

# We include the filename / line number information as both message and metadata, to ensure
# that github shows it.
msg_text = f"{msg['file_name']}:{msg.get('pos_line')}:{msg.get('pos_col')}:\n{msg.get('text')}"
msg_text = encode_msg_text_for_github(msg_text)
return f"::{msg.get('severity')} file={msg['file_name']},line={msg.get('pos_line')},col={msg.get('pos_col')}::{msg_text}"
return f"::{severity} file={msg['file_name']},line={msg.get('pos_line')},col={msg.get('pos_col')}::{msg_text}"

def write_and_print_noisy_files(noisy_files):
with open('src/.noisy_files', 'w') as f:
Expand Down

0 comments on commit 0334475

Please sign in to comment.