public/Send-BuildStartMessage.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function Send-BuildStartMessage {
    [CmdletBinding()]
    param(
        [string[]]$BuildTask
    )

    $message = Get-BuildMessage -Start

    $buildTaskString = ($BuildTask -join ', ')

    $primaryAttachment = @{
        Color = '#228B22' 
        Title = ":running: Starting Build: $buildTaskString"
        Text = "Notify List: $(Get-BuildNotifyList)"
        Fallback = "Starting Build: $buildTaskString"
    }

    $null = New-SlackMessageAttachment @primaryAttachment |
        New-SlackMessage @message |
        Send-SlackMessage
}