Skip to content

Commit 12fe19a

Browse files
author
Egor Bryzgalov
committed
Adde schedule and slack notifications.
1 parent f28660e commit 12fe19a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Localize/localize-pipeline.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,26 @@ name: $(Date:MMddyy)$(Rev:.rrrr)
22

33
trigger: none
44

5+
schedules:
6+
- cron: 0 8 * * Mon # mm HH DD MM DW
7+
displayName: Localization update
8+
branches:
9+
include:
10+
- Localization
11+
always: true
12+
513
stages:
614
- stage: __default
715
jobs:
816
- job: Job1
917
pool:
1018
vmImage: windows-latest
1119
steps:
20+
- powershell: |
21+
$week = (Invoke-WebRequest https://whatsprintis.it -Headers @{"Accept"= "application/json"} | ConvertFrom-Json).week
22+
Write-Host "##vso[task.setvariable variable=week]$week"
23+
displayName: "Determine the number of the week in the sprint"
24+
1225
- task: OneLocBuild@2
1326
inputs:
1427
locProj: 'Localize/LocProject.json'
@@ -22,6 +35,19 @@ stages:
2235
isAutoCompletePrSelected: false
2336
env:
2437
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
38+
39+
- powershell: |
40+
$body = '{"text": "Created agent localization update PR. Someone please approve/merge it. :please-puss-in-boots:"}'
41+
Invoke-RestMethod -Uri $(slackUri) -Method Post -Body $body -ContentType 'application/json'
42+
displayName: 'Send Slack notification'
43+
condition: and(succeeded(), eq(variables['WEEK'], '3'), eq(variables['build.reason'], 'Schedule'))
44+
45+
- powershell: |
46+
$buildUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)&_a=summary"
47+
$body = '{"text": "Something went wrong while creating agent localization update PR. Build: ' + $buildUrl + '"}'
48+
Invoke-RestMethod -Uri $(slackUri) -Method Post -Body $body -ContentType 'application/json'
49+
displayName: 'Send Slack notification'
50+
condition: and(failed(), eq(variables['WEEK'], '3'), eq(variables['build.reason'], 'Schedule'))
2551
2652
- task: PublishBuildArtifacts@1
2753
displayName: 'Publish Artifact: drop'

0 commit comments

Comments
 (0)