scripts: ci: check_compliance.py: Allow multiline annotations

Encode annotation message to allow multiline messages.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2024-06-28 08:20:45 +02:00 committed by Anas Nashif
parent 690134356c
commit f21c97a9c5

View file

@ -1533,10 +1533,11 @@ def annotate(res):
""" """
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#about-workflow-commands https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#about-workflow-commands
""" """
msg = res.message.replace('%', '%25').replace('\n', '%0A').replace('\r', '%0D')
notice = f'::{res.severity} file={res.file}' + \ notice = f'::{res.severity} file={res.file}' + \
(f',line={res.line}' if res.line else '') + \ (f',line={res.line}' if res.line else '') + \
(f',col={res.col}' if res.col else '') + \ (f',col={res.col}' if res.col else '') + \
f',title={res.title}::{res.message}' f',title={res.title}::{msg}'
print(notice) print(notice)