Skip to content

Commit

Permalink
ci: actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma11hewThomas committed May 31, 2024
1 parent 998bae0 commit a6cd6ef
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ jobs:
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: build
run: npx tsc
- name: Build
run: npx tsc
- name: Send Slack Notification
run: npx slack-ctrf results ctrf-report.json
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,31 @@ It means a lot to us and helps us grow this open source library.
- **Send Test Results to Slack**: Automatically send test results to a Slack channel.
- **Conditional Notifications**: Use the `--onFailOnly` option to send notifications only if tests fail.

## Usage
## Setup

You'll need a CTRF report generated by your testing framework. [CTRF reporters](https://www.ctrf.io/docs/category/reporters) are available for most testing frameworks and easy to install.

### Send Test Results to Slack
### Create a Slack Incoming Webhook

1. Go to the [Slack API: Incoming Webhooks](https://api.slack.com/messaging/webhooks) page.
2. Click on "Create a Slack App" or use an existing app.
3. Add the "Incoming Webhooks" feature to your app.
4. Activate the Incoming Webhook and add a new webhook to your workspace.
5. Copy the webhook URL provided.

### Set the Environment Variable

Set the webhook URL as an environment variable in your shell or CI environment:

```sh
export SLACK_WEBHOOK_URL='https://hooks.slack.com/services/your/webhook/url'
```

Make sure to replace `'https://hooks.slack.com/services/your/webhook/url'` with your actual webhook URL.

You might want to store the webhook URL as a secret.

## Usage

To send the test results summary to Slack:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slack-ctrf",
"version": "0.0.6",
"version": "0.0.7",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a6cd6ef

Please sign in to comment.