I have a multi-staged pipeline in which I want a specific stage's jobs only to run when a pull request is made to the Development branch.
The below YAML works yet the PS tasks are skipped even when I make a pull request to the Development branch. I also tried removing the source branch condition but to no avail.
trigger:
- Development
- Testing
- Acceptance
stages:
- stage: Development
condition: and(eq(variables['Build.SourceBranch'], 'refs/heads/Development'), eq(variables['Build.Reason'], 'PullRequest'))
jobs:
- job: "FirstValidationJob"
steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: 'Write-Host "Hello World!"'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: 'Write-Host "Hi mom, this is me running PowerShell code on Azure!"'