From 90a053377babada3b550b9cb1e779cce50ad0a55 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Fri, 14 Apr 2023 10:11:31 +0100 Subject: [PATCH] Send GHA annotations to stderr Fixes: #3253 --- src/ansiblelint/app.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ansiblelint/app.py b/src/ansiblelint/app.py index 3995b9ddc0c..5e4f8933407 100644 --- a/src/ansiblelint/app.py +++ b/src/ansiblelint/app.py @@ -85,9 +85,14 @@ def render_matches(self, matches: list[MatchError]) -> None: # If run under GitHub Actions we also want to emit output recognized by it. if os.getenv("GITHUB_ACTIONS") == "true" and os.getenv("GITHUB_WORKFLOW"): + _logger.info( + "GitHub Actions environment detected, adding annotations output..." + ) formatter = formatters.AnnotationsFormatter(self.options.cwd, True) for match in itertools.chain(fatal_matches, ignored_matches): - console.print(formatter.format(match), markup=False, highlight=False) + console_stderr.print( + formatter.format(match), markup=False, highlight=False + ) # If sarif_file is set, we also dump the results to a sarif file. if self.options.sarif_file: