<commit_before># drone-slack-blame
Drone plugin for sending Slack notifications

## Overview

This plugin is responsible for sending build notifications to developers when
they break the build, either directly through slackbot messages, or to the
designated channel. This lets developers get feedback on their own feature
branches without bombarding the main development channel as well as notifying
the channel on important branches such as release or master.

## Usage

```sh
./drone-slack-blame <<EOF
{
    "repo" : {
        "owner": "foo",
        "name": "bar",
        "self_url": "http://my.drone.io/foo/bar"
    },
    "build" : {
        "number": 22,
        "status": "failed",
        "started_at": 1421029603,
        "finished_at": 1421029813,
        "head_commit": {
            "sha": "9f2849d5",
            "branch": "master",
            "message": "Update the Readme",
            "author": {
                "login": "johnsmith",
                "email": "<EMAIL>"
            }
        }
    },
    "vargs": {
        "token": "xxxxxx",
        "channel": "#dev",
        "success": {
            "username": "Happy Keanu (on behalf of Drone)",
            "icon": ":happy_keanu:",
            "message": "The build is fixed!",
            "image_attachments": [
                "http://i.imgur.com/TP4PIxc.jpg"
            ]
        },
        "failure": {
            "username": "Sad Keanu (on behalf of Drone)",
            "icon": ":sad_keanu:",
            "message": "The build is broken!",
            "image_attachments": [
                "http://cdn.meme.am/instances/51000361.jpg"
            ]
        }
    }
}
EOF
```

## Docker

Build the Docker container. Note that we need to use the `-netgo` tag so that
the binary is built without a CGO dependency:

```sh
CGO_ENABLED=0 go build -a -tags netgo
docker build --rm=true -t plugins/drone-slack .
```

Send a Slack notification:

```sh
docker run -i plugins/drone-slack-blame <<EOF
{
    "repo" : {
        "owner": "foo",
        "name": "bar",
        "self_url": "http://my.drone.io/foo/bar"
    },
    "build" : {
        "number": 22,
        "status": "failed",
        "started_at": 1421029603,
        "finished_at": 1421029813,
        "head_commit": {
            "sha": "9f2849d5",
            "branch": "master",
            "message": "Update the Readme",
            "author": {
                "login": "johnsmith",
                "email": "<EMAIL>"
            }
        }
    },
    "vargs": {
        "token": "xxxxxx",
        "channel": "#dev",
        "success": {
            "username": "Happy Keanu (on behalf of Drone)",
            "icon": ":happy_keanu:",
            "message": "The build is fixed!",
            "image_attachments": [
                "http://i.imgur.com/TP4PIxc.jpg"
            ]
        },
        "failure": {
            "username": "Sad Keanu (on behalf of Drone)",
            "icon": ":sad_keanu:",
            "message": "The build is broken!",
            "image_attachments": [
                "http://cdn.meme.am/instances/51000361.jpg"
            ]
        }
    }
}
EOF
```<commit_msg>Updating readme examples for running<commit_after># drone-slack-blame
Drone plugin for sending Slack notifications

## Overview

This plugin is responsible for sending build notifications to developers when
they break the build, either directly through slackbot messages, or to the
designated channel. This lets developers get feedback on their own feature
branches without bombarding the main development channel as well as notifying
the channel on important branches such as release or master.

## Usage

```sh
./drone-slack-blame <<EOF
{
    "repo" : {
        "owner": "foo",
        "name": "bar",
        "full_name": "foo/bar"
    },
    "system": {
        "link_url": "http://mydrone.io"
    },
    "build" : {
        "number": 22,
        "status": "failed",
        "started_at": 1421029603,
        "finished_at": 1421029813,
        "commit": "9f2849d5",
        "branch": "master",
        "message": "Update the Readme",
        "author": "johnsmith",
        "author_email": "<EMAIL>"
    },
    "vargs": {
        "token": "xxxxxx",
        "channel": "dev",
        "success": {
            "username": "Happy Keanu (on behalf of Drone)",
            "icon": ":happy_keanu:",
            "message": "The build is fixed!",
            "image_attachments": [
                "http://i.imgur.com/TP4PIxc.jpg"
            ]
        },
        "failure": {
            "username": "Sad Keanu (on behalf of Drone)",
            "icon": ":sad_keanu:",
            "message": "The build is broken!",
            "image_attachments": [
                "http://cdn.meme.am/instances/51000361.jpg"
            ]
        }
    }
}
EOF

```

## Docker

Build the Docker container. Note that we need to use the `-netgo` tag so that
the binary is built without a CGO dependency:

```sh
CGO_ENABLED=0 go build -a -tags netgo
docker build --rm=true -t plugins/drone-slack .
```

Send a Slack notification:

```sh
docker run -i plugins/drone-slack-blame <<EOF
{
    "repo" : {
        "owner": "foo",
        "name": "bar",
        "full_name": "foo/bar"
    },
    "system": {
        "link_url": "http://mydrone.io"
    },
    "build" : {
        "number": 22,
        "status": "failed",
        "started_at": 1421029603,
        "finished_at": 1421029813,
        "commit": "9f2849d5",
        "branch": "master",
        "message": "Update the Readme",
        "author": "johnsmith",
        "author_email": "<EMAIL>"
    },
    "vargs": {
        "token": "xxxxxx",
        "channel": "dev",
        "success": {
            "username": "Happy Keanu (on behalf of Drone)",
            "icon": ":happy_keanu:",
            "message": "The build is fixed!",
            "image_attachments": [
                "http://i.imgur.com/TP4PIxc.jpg"
            ]
        },
        "failure": {
            "username": "Sad Keanu (on behalf of Drone)",
            "icon": ":sad_keanu:",
            "message": "The build is broken!",
            "image_attachments": [
                "http://cdn.meme.am/instances/51000361.jpg"
            ]
        }
    }
}
EOF
```
{'fraction_non_alphanumeric': 0.1489841986455982, 'fraction_numerical': 0.02418574653337633, 'mean_word_length': 1.8272561531449407, 'pattern_counts': {'":': 116, '<': 15, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6551589', 'n_tokens_mistral': 2074, 'n_tokens_neox': 1897, 'n_words': 514}