public/Send-BuildStartTaskMessage.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function Send-BuildStartTaskMessage {
    [CmdletBinding()]
    param(
        [object]$Task
    )

    $message = Get-BuildMessage -Start

    $primaryAttachment = @{
        Color = '#228B22' 
        Title = ":arrow_forward: Starting Task: $($Task.Name)"
        Text = "Time: $($Task.Started.ToString('yyyy-MM-dd hh:mm:ss'))"
        Fallback = "Starting Task: $($Task.Name)"
    }

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