...

Text file src/github.com/Azure/azure-sdk-for-go/eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml

Documentation: github.com/Azure/azure-sdk-for-go/eng/common/pipelines/templates/steps

     1# cSpell:ignore changedfiles
     2# cSpell:ignore Committish
     3# cSpell:ignore LASTEXITCODE
     4
     5steps:
     6  - template: /eng/common/pipelines/templates/steps/set-default-branch.yml
     7  - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
     8    - pwsh: |
     9        # Find the default branch of the repo. The variable value sets in build step.
    10        Write-Host "Default Branch: $(DefaultBranch)"
    11
    12        if ((!"$(System.PullRequest.SourceBranch)".StartsWith("sync-eng/common")) -and "$(System.PullRequest.TargetBranch)" -match "^(refs/heads/)?$(DefaultBranch)$")
    13        {
    14          $filesInCommonDir  = & "eng/common/scripts/get-changedfiles.ps1" -DiffPath 'eng/common/*'
    15          if (($LASTEXITCODE -eq 0) -and ($filesInCommonDir.Count -gt 0))
    16          {
    17            Write-Host "##vso[task.LogIssue type=error;]Changes to files under 'eng/common' directory should not be made in this Repo`n${filesInCommonDir}"
    18            Write-Host "##vso[task.LogIssue type=error;]Please follow workflow at https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/common_engsys.md"
    19            exit 1
    20          }
    21        }
    22      displayName: Prevent changes to eng/common outside of azure-sdk-tools repo
    23      condition: and(succeeded(), ne(variables['Skip.EngCommonWorkflowEnforcer'], 'true'), not(endsWith(variables['Build.Repository.Name'], '-pr')))

View as plain text