Describe your use case and the problem you are facing
GitHub Actions is a very popular choice for CI and used by a lot of WordPress projects.
Actions can communicate with the runner machine to set environment variables, output values used by other actions, add debug messages to the output logs, and other tasks.
They can use a specific format to send messages that result in direct code annotations displayed on GitHub. Annotations can associate the message with a particular file in the repository and even with a specific position within the file.
Having a built-in way in WP-CLI to print such messages/annotations might be useful for WP-CLI commands such as wp i18n or Traduttore, but also others, as it allows one to easily use them in a GitHub Action context without any extra overhead.
Feature Request
Describe your use case and the problem you are facing
GitHub Actions is a very popular choice for CI and used by a lot of WordPress projects.
Actions can communicate with the runner machine to set environment variables, output values used by other actions, add debug messages to the output logs, and other tasks.
They can use a specific format to send messages that result in direct code annotations displayed on GitHub. Annotations can associate the message with a particular file in the repository and even with a specific position within the file.
See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
Example:
Having a built-in way in WP-CLI to print such messages/annotations might be useful for WP-CLI commands such as
wp i18n
or Traduttore, but also others, as it allows one to easily use them in a GitHub Action context without any extra overhead.Related:
Describe the solution you'd like
The first possible solution that came to mind is extending the Formatter, adding a new
github-actions
case here:https://github.com/wp-cli/wp-cli/blob/c3bd5bd76abf024f9d492579539646e0d263a05a/php/WP_CLI/Formatter.php#L133-L181
Similar to the table formatter it could take an array like this and echo the output as expected by GitHub Actions:
Then commands could support this via a
--format
argument, e.g.--format=github-actions