Builds a Slack Block Kit message payload using information from a Jenkins job, or any other information source. The message is contructed based on templates found in BlockKitTemplates folder.
Clone the repository and try it out with:
$data = Get-Content './SampleData_success.json' -Raw
$message = ./CreateBuildReportMessage -JobName 'ios' -JsonData $data
Write-Output $message
JsonData - The JSON string containing the required paramteres, check this SampleData for a list of the required parameters.
JobName - The name of the JOB, it will be used in the title of the message and to get the matching image from the folder, example: myplatform_green.png will be used in case of success.
ReturnInsideBlockArray - True by default, the message comes inside {block: []}
array, ready to be sent to Slack. If you are composing multiple messages, set this to false to get the raw Block Kit elements.
Call Sample:
.\CreateBuildReportMessage -JobName 'MyBuild' -JsonData 'JsonData' -ReturnInsideBlockArray $true
iOS Build Success
Apple TV Build Failure
// TODO