From 899391263908c89a4d73692a0e148b90679ab5a6 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Thu, 30 Jan 2020 00:01:57 +0800 Subject: [PATCH 1/3] add PR title check --- azure-pipelines.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b1dec92cccc..f052f6f132c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,6 +8,19 @@ 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 "Pull Request Number: $(System.PullRequest.PullRequestNumber)" + title =$(curl https://api.github.com/repos/Azure/azure-cli/pulls/$(System.PullRequest.PullRequestNumber) | jq -r '.title') + [[ $title =~ ^(\[.*\]|\{.*\}).* ]] && exit 0 + exit 1 + - job: RejectPullRequestToMasterBranch displayName: "Reject Pull Request To Master Branch" condition: and(succeeded(), eq(variables['System.PullRequest.TargetBranch'], 'master')) From 25639b0030a3c0c9b9a59891ebb4bc44035db238 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Thu, 30 Jan 2020 21:22:27 +0800 Subject: [PATCH 2/3] fix bash space --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f052f6f132c..e081f64cf82 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,7 +17,7 @@ jobs: steps: - bash: | echo "Pull Request Number: $(System.PullRequest.PullRequestNumber)" - title =$(curl https://api.github.com/repos/Azure/azure-cli/pulls/$(System.PullRequest.PullRequestNumber) | jq -r '.title') + title=$(curl https://api.github.com/repos/Azure/azure-cli/pulls/$(System.PullRequest.PullRequestNumber) | jq -r '.title') [[ $title =~ ^(\[.*\]|\{.*\}).* ]] && exit 0 exit 1 From 6943a8f164aea2a8b5471f14ed8b8a28f7337645 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Thu, 30 Jan 2020 22:48:08 +0800 Subject: [PATCH 3/3] add instruction url --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e081f64cf82..b71717313a2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,9 +16,10 @@ jobs: vmImage: 'ubuntu-16.04' steps: - bash: | - echo "Pull Request Number: $(System.PullRequest.PullRequestNumber)" + 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