How to bypass policies when merging using Create PR task

Mehta, Dharmi 0 Reputation points
2024-07-22T20:27:00.4266667+00:00

I am trying to use the Create PR task in a pipeline to merge changes from my source branch to target branch (master). I want to bypass the policies of having reviewers and linking work item. I changed the configuration for my project collection service account(which creates the automated PR) for contribute to pull request to "Allow", Bypass policies while completing pull requests to "Allow", Bypass policies when pushing to "Allow". However, the policy is not getting bypassed and I still get the prompt to link work items to complete my PR.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,742 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VarunTha 5,895 Reputation points Microsoft Vendor
    2024-07-22T21:39:32.4833333+00:00

    Hi Mehta, Dharmi,
    Welcome to the Microsoft Q&A Community Forum. Please note that Azure DevOps questions are not supported here. For expert assistance, refer to the contacts listed in this document.

    However, to make Build Validation within the branch policy controllable, you can enable the "Bypass policies when completing pull request" option in the branch policy settings. This allows developers to bypass the branch policy when completing a pull request.

    To enable this option, follow these steps:

    1. Navigate to the branch policy settings for the desired branch.
    2. Under the "Policy" section, select "Build validation."
    3. Click the "Edit" button to modify the policy.
    4. In the "General" section, enable the "Bypass policies when completing pull request" option.
    5. Save the changes.

    Once this option is enabled, developers can choose to bypass the build validation policy when creating a pull request by selecting the "Bypass" option.

    Please note that enabling this option can reduce the effectiveness of your branch policies, so it should be used with caution.

    Reference document:https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops&tabs=browser#bypass-branch-policies

    Please don't forget to Accept helpful answer and close this thread.

    0 comments No comments