<p>I don't think you can alter the trigger right now in Azure DevOps. What I do is to create an extra task to start with, and use powershell (or your language of choice) to check if the week number is even or odd and then proceed with the build or not. </p>

CC BY-SA 4.0
2020-01-27T08:20:38.203Z
Yeah, thats what I ended up doing. For reference:

```$NumberOfSecondsInWeek = 604800
$WeekNumber = [System.Math]::Ceiling((Get-Date -UFormat %s) / $NumberOfSecondsInWeek)
$IsEndOfSprint = ($WeekNumber % 2) -eq $(end-of-sprint-week-number)

Write-Host "##vso[task.setvariable variable=is-end-of-sprint]$IsEndOfSprint"
```
Anthony Cleaver
CC BY-SA 4.0
2020-01-28T12:34:59.547Z
That looks complicated... not sure why you're doing stuff using seconds... You could get the weeknumber simply with `Get-Date -uformat %V`
GetShifting
CC BY-SA 4.0
2020-01-24T13:11:29.553Z
2020-01-24T13:11:29.553Z
GetShifting
<p>I'm trying to write a build pipeline that runs every second friday (essentially at the end of a sprint). Using the classic editor it appears I can only set a trigger that would run every friday. Is there any way I can achieve what I'm after?</p>

<p>Perhaps it runs every week but stops immediately if it can interpret the when the build was last run (although that doesn't seem to be exposed anywhere). I guess another alternative would be a triggering build that calls to the devops API to figure out if its the last day of the timebox. Neither of theses are ideal though for a fairly simple requirement (imo).</p>

<p>Thanks</p>

<azure-devops><azure-pipelines>
Azure devops, fortnightly build trigger
Anthony Cleaver
# Azure devops, fortnightly build trigger

(Asked by: username_0 on 2020-01-13)

I'm trying to write a build pipeline that runs every second friday (essentially at the end of a sprint). Using the classic editor it appears I can only set a trigger that would run every friday. Is there any way I can achieve what I'm after?

Perhaps it runs every week but stops immediately if it can interpret the when the build was last run (although that doesn't seem to be exposed anywhere). I guess another alternative would be a triggering build that calls to the devops API to figure out if its the last day of the timebox. Neither of theses are ideal though for a fairly simple requirement (imo).

Thanks

**Tags:** azure-devops, azure-pipelines


---

## 1 answers

### Answer by username_1 on 2020-01-24. Score: 0 | Accepted answer

I don't think you can alter the trigger right now in Azure DevOps. What I do is to create an extra task to start with, and use powershell (or your language of choice) to check if the week number is even or odd and then proceed with the build or not.

> **Comments:**
> **username_0**: Yeah, thats what I ended up doing. For reference:  ```$NumberOfSecondsInWeek = 604800 $WeekNumber = [System.Math]::Ceiling((Get-Date -UFormat %s) / $NumberOfSecondsInWeek) $IsEndOfSprint = ($WeekNumber % 2) -eq $(end-of-sprint-week-number)  Write-Host "##vso[task.setvariable variable=is-end-of-sprint]$IsEndOfSprint" ```  
> **username_1**: That looks complicated... not sure why you're doing stuff using seconds... You could get the weeknumber simply with `Get-Date -uformat %V`  

---

