Github Action to send xUnit results to Slack.
This action will:
- Parse a xUnit-style XML report.
- Send summary to Slack workspace & channel of your choice.
- (Optional) Fail the build if errors or failures are found.
- A token for a Slack bot user. I recommend setting up the token as a secret.
- The channel ID to notify.
The following environment variables are supported:
Environment Variable | Description | Required? |
---|---|---|
XUNIT_PATH | Path (relative to workspce directory) to xUnit report | Y |
SLACK_TOKEN | Slack bot user token | Y |
SLACK_CHANNEL | Unique ID of slack channel to notify | Y |
EXIT_CODE_FROM_REPORT | If present, will fail workflow if errors or failures are in the report | N |
Sample Workflow section:
action "testsnotify" {
needs = "tests"
uses = "ivanklee86/xunit-slack-reporter@master"
env = {
SLACK_CHANNEL = "AAAAAAAA"
XUNIT_PATH = "./results.xml"
EXIT_CODE_FROM_REPORT = "True"
},
secrets = ["SLACK_TOKEN"]
}
- name: notify-tests
uses: ./
env:
EXIT_CODE_FROM_REPORT: "True"
SLACK_CHANNEL: CKQ7C7KJN
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
XUNIT_PATH: ./results.xml