The Final Piece: How to Trigger PR Builds

27 October 2025
Previous Post
Next Post

You correctly removed the pr: block from your YAML. This is the best practice. PR builds should be controlled by Branch Policies in the Azure DevOps UI, as this is more secure and explicit.

If your PRs are not triggering, it's because this UI setting is missing:

  1. Go to Repos > Branches.
  2. Find your develop branch, click the ... menu, and select Branch policies.
  3. Under "Build Validation," click the + button.
  4. Select your main "Assembly Line" pipeline (e.g., ODB pipeline).
  5. Set the trigger to Automatic and the requirement to Required.
  6. Click Save and repeat for your main branch.

This policy, not your YAML, is now the "source of truth" for PR builds. Your Deploy stage's condition (ne(variables['Build.Reason'], 'PullRequest')) will automatically detect this is a "PullRequest" build and skip deployment.