[Feature Request] Use GitHub Annotation output when run in PR, regular output otherwise
I think this is consistent with other workflows, but now that I've used these workflows for a while, I'm seeing that "GitHub Annotation" format works very well on PRs, but very badly on regular commits.
In fact, on regular commits the annotations are printed without an indication of the file/line where the error happened, making it very hard to fix the issues. This is true for all the tools: PHPCS, Psalm, etc.
The ideal scenario would be using "GitHub Annotation" format when the current event is a PR, and standard console output in the other cases.
Originally posted by @gmazzap in https://github.com/inpsyde/reusable-workflows/pull/19#discussion_r994844930
I guess we can easily achieve that by adding following to the step:
if: github.event_name == 'pull_request'
github.event_name | string | The name of the event that triggered the workflow run.
Yes @Chrico the problem is that for Psalm, for example, we have a PSALM_ARGS configuration, which has a default that contains --output-format=github, so to implement this we should have a default with that change based on the github.event_name context.
Or maybe we remove that part from the default and add a separate input AUTO_OUTPUT_FORMAT that when true will append output-format dynamically based on github.event_name and would apply to Psalm and other tools.
This way people can still have custom PSALM_ARGS (or other tools' args) and have a dynamic output format.