Skip to content

Instantly share code, notes, and snippets.

@LSTANCZYK
Created January 25, 2016 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LSTANCZYK/058cd0659760177acb39 to your computer and use it in GitHub Desktop.
Save LSTANCZYK/058cd0659760177acb39 to your computer and use it in GitHub Desktop.
HipChat notification of new App Veyor deployment
[cmdletbinding()]
Param(
[Parameter(Position = 0,Mandatory = $True )]
[string]$apitoken,
[Parameter(Position = 1,Mandatory = $True )]
[string]$roomid
)
process {
$json="
{
`"color`": `"purple`",
`"message_format`": `"text`",
`"card`" : {
`"style`": `"application`",
`"format`": `"medium`",
`"url`" : `"https://ci.appveyor.com/project/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG`",
`"id`": `"$env:APPVEYOR_BUILD_ID`",
`"title`" : `"New Deployment`",
`"icon`": {
`"url`": `"http://softwaremanagementblog.net/wp-content/uploads/2015/05/icon_deployment-300x300.png`"
},
`"attributes`": [
{
`"label`": `"Application`",
`"value`": {
`"label`": `"$env:APPVEYOR_PROJECT_NAME`",
`"style`":`"lozenge-current`"
}
},
{
`"label`": `"Version`",
`"value`": {
`"label`": `"$env:APPVEYOR_BUILD_VERSION`",
`"style`":`"lozenge-success`"
}
},
{
`"label`": `"Commit`",
`"value`": {
`"label`": `"$env:APPVEYOR_REPO_COMMIT - $env:APPVEYOR_REPO_COMMIT_AUTHOR: $env:APPVEYOR_REPO_COMMIT_MESSAGE`"
}
}
]
},
`"message`": `"New deployment for $env:APPVEYOR_PROJECT_NAME`",
`"from`":`"Deployment`",
`"notify`":`"true`"
}
"
Invoke-WebRequest -Uri https://api.hipchat.com/v2/room/$roomid/notification?auth_token=$apitoken -Method Post -ContentType 'application/json' -Body $json
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment