diff --git a/lib/ansiblelint/formatters/__init__.py b/lib/ansiblelint/formatters/__init__.py index 9c22d2a938..7395183f11 100644 --- a/lib/ansiblelint/formatters/__init__.py +++ b/lib/ansiblelint/formatters/__init__.py @@ -107,9 +107,9 @@ class AnnotationsFormatter(BaseFormatter): in a form of GitHub Checks API annotations that appear rendered in pull- request files view. - ::debug file={name},line={line},col={col}::{message} - ::warning file={name},line={line},col={col}::{message} - ::error file={name},line={line},col={col}::{message} + ::debug file={name},line={line},col={col},severity={severity}::{message} + ::warning file={name},line={line},col={col},severity={severity}::{message} + ::error file={name},line={line},col={col},severity={severity}::{message} Supported levels: debug, warning, error """ @@ -123,9 +123,10 @@ def format(self, match: "MatchError", colored: bool = False) -> str: file_path = self._format_path(match.filename or "") line_num = match.linenumber rule_id = match.rule.id + severity = match.rule.severity violation_details = match.message return ( - f"::{level} file={file_path},line={line_num}" + f"::{level} file={file_path},line={line_num},severity={severity}" f"::[E{rule_id}] {violation_details}" ) diff --git a/test/TestCliRolePaths.py b/test/TestCliRolePaths.py index bfd1490e71..a459df20a4 100644 --- a/test/TestCliRolePaths.py +++ b/test/TestCliRolePaths.py @@ -128,7 +128,7 @@ def test_run_playbook_github(result, env): result_gh = run_ansible_lint(role_path, cwd=cwd, env=env) expected = ( - '::error file=examples/example.yml,line=47::[E101] ' + '::error file=examples/example.yml,line=47,severity=MEDIUM::[E101] ' 'Deprecated always_run' ) assert (expected in result_gh.stdout) is result