Skip to content

Commit

Permalink
{CI} Add PR title check (#11982)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengzhou-msft authored Jan 31, 2020
1 parent d7ca710 commit a81c06d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ trigger:
- '*'

jobs:
- job: CheckPullRequestTitle
displayName: "Check the Format of Pull Request Title"
condition: and(succeeded(), in(variables['System.PullRequest.TargetBranch'], 'dev', 'release'))

pool:
vmImage: 'ubuntu-16.04'
steps:
- bash: |
echo "Check Title of Pull Request: #$(System.PullRequest.PullRequestNumber)"
title=$(curl https://api.github.com/repos/Azure/azure-cli/pulls/$(System.PullRequest.PullRequestNumber) | jq -r '.title')
[[ $title =~ ^(\[.*\]|\{.*\}).* ]] && exit 0
echo "Pull Request title should follow https://aka.ms/submitAzPR"
exit 1
- job: RejectPullRequestToMasterBranch
displayName: "Reject Pull Request To Master Branch"
condition: and(succeeded(), eq(variables['System.PullRequest.TargetBranch'], 'master'))
Expand Down

0 comments on commit a81c06d

Please sign in to comment.