Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should protect both main & master initially?

Copy link
Copy Markdown
Contributor Author

@zhenglaizhang zhenglaizhang Aug 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for block private spec repo merge to main branch.
I am testing another task for blocking sending PR to master branch, this new task will be removed after the transition period.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already added check , after renaming, we can merge the PR and mark the check public.rest-api-specs (ShouldSendPRToMain) as required, e.g. https://github.com/Azure/azure-rest-api-specs/pull/15465/checks?check_run_id=3216862934

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