Skip to content

Commit

Permalink
set default branch as main for pipeline (#15465)
Browse files Browse the repository at this point in the history
* set default branch as main

* block pr to public spec repo
  • Loading branch information
zhenglaizhang authored Aug 2, 2021
1 parent 88e7838 commit 1aabb7f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/BranchProtectionForPrivateRepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions .azure-pipelines/ShouldSendPRToMain.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ variables:
PR_ONLY: 'true'

jobs:
- template: .azure-pipelines/BranchProtectionForPrivateRepo.yml
- template: .azure-pipelines/BranchProtectionForPrivateRepo.yml
- template: .azure-pipelines/ShouldSendPRToMain.yml

0 comments on commit 1aabb7f

Please sign in to comment.