# GithubActionsFormatter
[](https://hex.pm/packages/github_actions_formatter)
[](https://hexdocs.pm/github_actions_formatter)
An `ExUnit.Formatter` that emits [GitHub Actions workflow commands](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions) so that failing tests show up as inline annotations within the PR diff.
## Installation
Add to `mix.exs`:
```elixir
def deps do
[{:github_actions_formatter, "~> 0.1", only: :test}]
end
```
## Usage
In `test/test_helper.exs`:
```elixir
ExUnit.start(formatters: [ExUnit.CLIFormatter, GithubActionsFormatter])
```
The formatter auto-detects `GITHUB_ACTIONS=true` and will stay silent elsewhere. Local `mix test` runs are unaffected.
## Output
For each failing test, the formatter prints one line like:
```
::error file=test/widget_test.exs,line=42,title=My.Test failing test::Assertion failed: expected 10, got 9
```
GitHub renders this as a red annotation on the failing line in the PR diff.
## Configuration
`:enabled` defaults to `System.get_env("GITHUB_ACTIONS") == "true"`. Force it on locally:
```elixir
config :github_actions_formatter, enabled: true
```
## License
MIT — see [LICENSE](LICENSE).