Skip to content

Commit ace6d0a

Browse files
committed
Add CI for api surface area review verification
1 parent 9f2a559 commit ace6d0a

File tree

2 files changed

+33
-155
lines changed

2 files changed

+33
-155
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: API Surface Area Review Verification
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened, labeled, unlabeled ]
6+
branches:
7+
- master
8+
9+
jobs:
10+
api-surface-area-review-verification:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- id: api-surface-area-review-verification
15+
- name: Verifies updates to protected/public APIs have been reviewed and approved by the team, if any
16+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'api-surface-area-approved-by-team') }}
17+
run: |
18+
git fetch origin ${{ github.base_ref }} --depth 1
19+
echo "retrieving files"
20+
FILES=$(git diff remotes/origin/${{ github.base_ref }} --name-only | grep "\.java$" | grep -v -E "(^|/)(internal|test|codegen|v2-migration)/")
21+
echo "$FILES"
22+
if [ -n "$FILES" ]; then
23+
echo "::error::Changes around protected/public APIs found:"
24+
echo "has_matches=true" >> $GITHUB_OUTPUT
25+
else
26+
echo "No changes around protected/public APIs found."
27+
echo "has_matches=false" >> $GITHUB_OUTPUT
28+
fi
29+
- name: Error message
30+
if: steps.api-surface-area-review-verification.outputs.has_matches == 'true'
31+
run: |
32+
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"
33+
exit 1

.github/workflows/codebuild-ci.yml

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)