From 3282a05d4948ced1b72a790d070d9ce28407700c Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 11 Feb 2021 10:12:13 -0800 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 1358 (#1669) * Extend Get-GitHubPullRequest to return only files * Add check to prevent eng/common changes that are not proper syncs * Update eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml Co-authored-by: Wes Haggard * Update eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml Co-authored-by: Wes Haggard Co-authored-by: Chidozie Ononiwu Co-authored-by: Chidozie Ononiwu <31145988+chidozieononiwu@users.noreply.github.com> Co-authored-by: Wes Haggard --- .../steps/eng-common-workflow-enforcer.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml diff --git a/eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml b/eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml new file mode 100644 index 000000000..7163d2bad --- /dev/null +++ b/eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml @@ -0,0 +1,13 @@ +steps: + - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - pwsh: | + $filesInCommonDir = git diff "origin/$(System.PullRequest.TargetBranch)" HEAD --name-only -- 'eng/common/*' + + if ((-not $PrSourceBranch.StartsWith("sync-eng/common")) -and ($filesInCommonDir.Count -gt 0)) + { + Write-Host "##vso[task.LogIssue type=error;]Changes to files under 'eng/common' directory should not be made in this Repo`n${filesInCommonDir}" + Write-Host "##vso[task.LogIssue type=error;]Please follow workflow at https://github.com/Azure/azure-sdk-tools/blob/master/doc/common/common_engsys.md" + exit 1 + } + displayName: Prevent changes to eng/common outside of azure-sdk-tools repo + condition: and(succeeded(), ne(variables['Skip.EngCommonWorkflowEnforcer'], 'true'))