Skip to content

Commit

Permalink
Adde schedule and slack notifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
egor-bryzgalov committed Feb 17, 2021
1 parent f28660e commit 12fe19a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Localize/localize-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,26 @@ name: $(Date:MMddyy)$(Rev:.rrrr)

trigger: none

schedules:
- cron: 0 8 * * Mon # mm HH DD MM DW
displayName: Localization update
branches:
include:
- Localization
always: true

stages:
- stage: __default
jobs:
- job: Job1
pool:
vmImage: windows-latest
steps:
- powershell: |
$week = (Invoke-WebRequest https://whatsprintis.it -Headers @{"Accept"= "application/json"} | ConvertFrom-Json).week
Write-Host "##vso[task.setvariable variable=week]$week"
displayName: "Determine the number of the week in the sprint"
- task: OneLocBuild@2
inputs:
locProj: 'Localize/LocProject.json'
Expand All @@ -22,6 +35,19 @@ stages:
isAutoCompletePrSelected: false
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)

- powershell: |
$body = '{"text": "Created agent localization update PR. Someone please approve/merge it. :please-puss-in-boots:"}'
Invoke-RestMethod -Uri $(slackUri) -Method Post -Body $body -ContentType 'application/json'
displayName: 'Send Slack notification'
condition: and(succeeded(), eq(variables['WEEK'], '3'), eq(variables['build.reason'], 'Schedule'))
- powershell: |
$buildUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)&_a=summary"
$body = '{"text": "Something went wrong while creating agent localization update PR. Build: ' + $buildUrl + '"}'
Invoke-RestMethod -Uri $(slackUri) -Method Post -Body $body -ContentType 'application/json'
displayName: 'Send Slack notification'
condition: and(failed(), eq(variables['WEEK'], '3'), eq(variables['build.reason'], 'Schedule'))
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
Expand Down

0 comments on commit 12fe19a

Please sign in to comment.