How to trigger a build on PR without branch policies?

Fabian Martin 0 Reputation points
2024-10-28T15:05:40.3033333+00:00

Hello, I wanted to discuss a potential enhancement to our Azure Pipeline setup. Currently, we have a configuration that triggers a build automatically after a pull request (PR) is completed for the following branches: main, feature/*, and patch/*. Here’s the existing configuration:

trigger:
  branches:
    exclude:
      - '*' # disable automatic builds for single commits
pr:
  branches:
    include:
      - 'main'
      - 'feature/*'
      - 'patch/*'

However, we're aiming to improve our development workflow by triggering builds during the PR process itself (like those PR towards main branch, which has branch policies). This means we’d like to initiate a build whenever a PR is opened, not just when it's completed, ensuring that all code changes pass builds and tests before integration. This setup is intended to apply to PRs from one feature branch to another for example.

Branch policies do not seem to be a feasible solution, since the option to delete the source branch is grayed out.

Could you please provide any insights or suggestions on how we might configure our pipeline to achieve this? Your expertise would be greatly appreciated.

Thank you for your assistance.

Best regards,

Fabian-Ionuț Martin.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,739 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.