File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
eng/common/pipelines/templates/steps Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 11steps :
22 - ${{ if eq(variables['Build.Reason'], 'PullRequest') }} :
33 - pwsh : |
4- $filesInCommonDir = git diff "origin/$(System.PullRequest.TargetBranch)" HEAD --name-only -- 'eng/common/*'
4+ Set-PsDebug -Trace 1
5+ # Find the default branch of the repo
6+ $defaultBranch = (git remote show origin | Out-String) -replace "(?ms).*HEAD branch: (\w+).*", '$1'
7+ $targetBranch = "$(System.PullRequest.TargetBranch)" -replace "refs/heads/"
58
6- if ((!"$(System.PullRequest.SourceBranch)".StartsWith("sync-eng/common")) -and ($LASTEXITCODE -eq 0) -and ($filesInCommonDir.Count -gt 0))
9+ Write-Host "Default Branch: ${defaultBranch}"
10+
11+ if ((!"$(System.PullRequest.SourceBranch)".StartsWith("sync-eng/common")) -and $targetBranch -eq $defaultBranch)
712 {
8- Write-Host "##vso[task.LogIssue type=error;]Changes to files under 'eng/common' directory should not be made in this Repo`n${filesInCommonDir}"
9- 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"
10- exit 1
13+
14+ $filesInCommonDir = git diff "origin/${targetBranch}" HEAD --name-only -- 'eng/common/*'
15+
16+ if (($LASTEXITCODE -eq 0) -and ($filesInCommonDir.Count -gt 0))
17+ {
18+ Write-Host "##vso[task.LogIssue type=error;]Changes to files under 'eng/common' directory should not be made in this Repo`n${filesInCommonDir}"
19+ 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"
20+ exit 1
21+ }
1122 }
1223 displayName: Prevent changes to eng/common outside of azure-sdk-tools repo
1324 condition: and(succeeded(), ne(variables['Skip.EngCommonWorkflowEnforcer'], 'true'))
You can’t perform that action at this time.
0 commit comments