We have a pre-deployment branch and a production branch, and would like to set security such that you can only create pull requests to the production from pre deployment and not from other branches.
How can i do this ?
Thanks
We have a pre-deployment branch and a production branch, and would like to set security such that you can only create pull requests to the production from pre deployment and not from other branches.
How can i do this ?
Thanks
There are workaround to achieve this.
You should first create a build pipeline with a powershell task executing below script to check if the pull request source branch is the restricted branch.
$sourceBranch = "$(System.PullRequest.SourceBranch)"
if($sourceBranch -ne "refs/heads/pre-deployment")
{
exit 1
}
And then add this build pipeline to the build policy under Build validation in branch policies of your production branch. After setting above build policy, the new pull request will trigger the build pipeline and fail if the source branch is not pre-deployment
Another way to do this is creating a pull request status server. please refer to the example here for more information