Updating the API specification for confidential ledger for custom endpoints an… #1996
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Protected Files | |
on: pull_request | |
jobs: | |
protected-files: | |
name: Protected Files | |
runs-on: ubuntu-latest | |
steps: | |
# Allow bot account 'azure-sdk' to update protected files. | |
# Since check is required, the job itself cannot be skipped. | |
- name: Allow bot account 'azure-sdk' | |
if: github.event.pull_request.user.login == 'azure-sdk' | |
run: echo "Bot account 'azure-sdk' is allowed to update protected files" | |
- uses: actions/checkout@v4 | |
if: github.event.pull_request.user.login != 'azure-sdk' | |
with: | |
# Required since "HEAD^" is passed to Get-ChangedFiles | |
fetch-depth: 2 | |
- name: Detect changes to protected files | |
if: github.event.pull_request.user.login != 'azure-sdk' | |
run: | | |
. eng/scripts/ChangedFiles-Functions.ps1 | |
$protectedFiles = @("package.json", "package-lock.json") | |
$changedFiles = @(Get-ChangedFiles -baseCommitish HEAD^ -targetCommitish HEAD -diffFilter "") | |
$matchedFiles = @($protectedFiles | Where-Object { $changedFiles -contains $_}) | |
if ($matchedFiles.Count -gt 0) { | |
foreach ($file in $matchedFiles) { | |
Write-Output "::error file=$file::File '$file' should only be updated by the Azure SDK team. If intentional, the PR may be merged by the Azure SDK team via bypassing the branch protections." | |
} | |
exit 1 | |
} | |
else { | |
Write-Output "No changes to protected files: [$($protectedFiles -join ', ')]" | |
} | |
shell: pwsh |