# slackPrNotify

This step posts a slack message with PR title and url.

## Parameters

| Name          | Description                       | Type     | Default         | Required |
| ------------- | --------------------------------- | -------- | --------------- | -------- |
| channel       | The slack channel                 | `String` | n/a             | yes      |
| repo          | The Github repository name        | `String` | n/a             | yes      |
| message       | The contents of the slack message | `String` | PR description  | no       |
| owner         | The Github repository owner       | `String` | 'theorchard'    | no       |
| pullRequestId | Id of the pull request            | `String` | `env.CHANGE_ID` | no       |

## Usage

Note that the pull request ID is automatically picked up using the the `env.CHANGE_ID` variable. And the `env.CHANGE_ID` variable is only available for runs triggered by a pull request.
If running the step in a non PR branch, you need to provide the `pullRequestId` parameter.

### Post a slack message on stage success

```groovy
stage('Some PR task') {
    steps {
        performSomeTask()
    }
    post {
        success {
            slackPrNotify(
                repo: 'frontend-test',
                channel: '#test-team',
                message: '🚀 Task is done!'
            )
        }
    }
}
```
