Skip to content

Commit e81ef30

Browse files
authored
Fixed message formatting for courtesy pipeline notifications (microsoft#14260)
* Fixed message for courtesy push notification * Check week before sending notification * Remove extra condition * Better readability * Turn off notifications for manual runs
1 parent e5a345b commit e81ef30

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

azure-pipelines.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,17 @@ jobs:
6666
(
6767
in(dependencies.courtesy_push_windows.result, 'Failed', 'Skipped'),
6868
eq(variables['COURTESY_PUSH'], 'true'),
69-
in(variables['build.reason'], 'Schedule', 'Manual'),
69+
eq(variables['build.reason'], 'Schedule'),
7070
eq(variables['COURTESY_PUSH_NOTIFICATION'], 'true')
7171
)
7272
pool:
7373
vmImage: vs2017-win2016
7474
steps:
7575
- powershell: |
7676
# Notify slack channel about failed courtesy push PR creation
77-
$body = '{"text": "Failed to create courtesy push PR. Please review the results of failed build: $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI/$env:SYSTEM_TEAMPROJECT/_build/results?buildId=$env:BUILD_BUILDID&_a=summary"}'
77+
$pipelineLink = "$env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$env:SYSTEM_TEAMPROJECT/_build/results?buildId=$env:BUILD_BUILDID&_a=summary"
78+
$messageText = "Failed to create courtesy push PR. Please review the results of failed build: $($pipelineLink) "
79+
$body = '{"text": "'+$($messageText)+'"}'
7880
Invoke-RestMethod -Uri $(slackUri) -Method Post -Body $body -ContentType 'application/json'
7981
displayName: 'Send notification to the slack channel'
8082

0 commit comments

Comments
 (0)