Skip to content

Commit

Permalink
Move notifications about Tasks Localization PR from Slack to MS Teams…
Browse files Browse the repository at this point in the history
… - Part 1 (#15917)
  • Loading branch information
denis-tikhomirov authored and vmapetr committed Nov 3, 2022
1 parent ab0b522 commit e6554eb
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions Localize/localize-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,18 @@ stages:
displayName: Open a PR
condition: and(succeeded(), or(and(eq(variables['SHOULDCREATEPR'], 'True'), eq(variables['build.reason'], 'Schedule')), eq(variables['build.reason'], 'Manual')))

- powershell: |
$message="Created tasks localization update PR. Someone please approve/merge it. :please-puss-in-boots: $env:PR_LINK"
$body = [PSCustomObject]@{
text = $message
} | ConvertTo-Json
Invoke-RestMethod -Uri $(slackUri) -Method Post -Body $body -ContentType 'application/json'
displayName: 'Send Slack notification about PR opened'
# Two next tasks are used to notify about Localization update PRs
# Notifications are set by POST method to MS Teams webhook
# Body of message is compiled as Office 365 connector card
# More details about cards - https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#office-365-connector-card
- powershell: .\ci\localization-updates\send-notifications.ps1 -IsPRCreated $true -RepoName "Tasks"
displayName: 'Send MS Teams notification about PR opened'
env:
TEAMS_WEBHOOK: $(MSTeamsUri)
condition: and(succeeded(), eq(variables['SHOULDCREATEPR'], 'True'), eq(variables['build.reason'], 'Schedule'))

- powershell: |
$buildUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)&_a=summary"
$message="Something went wrong while creating tasks localization update PR. Build: $buildUrl"
$body = [PSCustomObject]@{
text = $message
} | ConvertTo-Json
Invoke-RestMethod -Uri $(slackUri) -Method Post -Body $body -ContentType 'application/json'
displayName: 'Send Slack notification about error'
- powershell: .\ci\localization-updates\send-notifications.ps1 -IsPRCreated $false -RepoName "Tasks"
displayName: 'Send MS Teams notification about error'
env:
TEAMS_WEBHOOK: $(MSTeamsUri)
condition: and(failed(), eq(variables['SHOULDCREATEPR'], 'True'), eq(variables['build.reason'], 'Schedule'))

0 comments on commit e6554eb

Please sign in to comment.