Skip to content

Add CI for api surface area review verification #6

Add CI for api surface area review verification

Add CI for api surface area review verification #6

name: API Surface Area Review Verification
on:
pull_request:
types: [ opened, synchronize, reopened, labeled, unlabeled ]
branches:
- master
jobs:
api-surface-area-review-verification:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Check failure on line 13 in .github/workflows/api-surface-area-review-verification.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/api-surface-area-review-verification.yml

Invalid workflow file

You have an error in your yaml syntax on line 13
- name: Verifies updates to protected/public APIs have been reviewed and approved by the team, if any
if: ${{ !contains(github.event.pull_request.labels.*.name, 'api-surface-area-approved-by-team') }}
run: |
git fetch origin ${{ github.base_ref }} --depth 1
# Get the list of Java files changed, excluding test, codegen, and internal
FILES=$(git diff remotes/origin/${{ github.base_ref }} --name-only | grep "\.java$" | grep -v -E "(^|/)(internal|test|codegen|v2-migration)/")
echo "$FILES"
# If there are any matching files, output them and set a flag
if [ -n "$FILES" ]; then
echo "::error::Changes around protected/public APIs found:"
# echo "$FILES" | while read file; do
# echo "::error::$file"
# done
echo "has_matches=true" >> $GITHUB_OUTPUT
else
echo "No changes around protected/public APIs found."
echo "has_matches=false" >> $GITHUB_OUTPUT
fi
- name: Error message
if: steps.api-surface-area-review-verification.outputs.has_matches == 'true'
run: |
echo "::error ::Change around public/protected APIs has been detected, please review it with the team and add the 'api-surface-area-reviewed' label to this PR afterwards"
exit 1