diff --git a/.azure-pipelines/BranchProtectionForPrivateRepo.yml b/.azure-pipelines/BranchProtectionForPrivateRepo.yml index 7c913b101274..a826a8ecf271 100644 --- a/.azure-pipelines/BranchProtectionForPrivateRepo.yml +++ b/.azure-pipelines/BranchProtectionForPrivateRepo.yml @@ -2,7 +2,7 @@ jobs: - job: "BranchProtectionForPrivateRepo" pool: vmImage: 'Ubuntu 16.04' - condition: and(variables['PRIVATE'], eq(variables['System.PullRequest.TargetBranch'], 'master')) + condition: and(variables['PRIVATE'], eq(variables['System.PullRequest.TargetBranch'], 'main')) steps: - script: '>&2 echo "the branch is protected"' failOnStderr: true diff --git a/.azure-pipelines/ShouldSendPRToMain.yml b/.azure-pipelines/ShouldSendPRToMain.yml new file mode 100644 index 000000000000..d139949faeb0 --- /dev/null +++ b/.azure-pipelines/ShouldSendPRToMain.yml @@ -0,0 +1,8 @@ +jobs: + - job: "ShouldSendPRToMain" + pool: + vmImage: 'Ubuntu 16.04' + condition: eq(variables['System.PullRequest.TargetBranch'], 'master') + steps: + - script: '>&2 echo "##vso[task.logissue type=error]Please edit the pull request to targeting new default branch main"' + failOnStderr: true diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 41ce06e0ca5f..96faf6d58c8a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,4 +18,5 @@ variables: PR_ONLY: 'true' jobs: -- template: .azure-pipelines/BranchProtectionForPrivateRepo.yml \ No newline at end of file +- template: .azure-pipelines/BranchProtectionForPrivateRepo.yml +- template: .azure-pipelines/ShouldSendPRToMain.yml \ No newline at end of file