-
Notifications
You must be signed in to change notification settings - Fork 57
47 lines (45 loc) · 1.26 KB
/
check-proto-break.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Check proto breaks
on:
pull_request:
types:
- opened
- synchronize
- edited
jobs:
check-if-code-change:
runs-on: ubuntu-latest
outputs:
change: ${{ steps.check.outputs.change }}
steps:
- uses: actions/checkout@v4
with:
go-version: '1.20'
fetch-depth: 0
- run: |
if git --no-pager diff --exit-code origin/main...HEAD -- . ':!docs' ':!*.md'; then
echo "::set-output name=change::false"
else
echo "::set-output name=change::true"
fi
id: check
check-proto-break:
needs: check-if-code-change
if: ${{ needs.check-if-code-change.outputs.change == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- run: go install github.com/bufbuild/buf/cmd/[email protected]
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if PR is breaking
run: |
if [[ "${{ github.event.pull_request.title }}" == *'!'* ]]; then
echo "PR is a breaking change by title"
exit 0
else
echo "Checking if PR is a breaking change"
buf breaking --path ./api/protobuf/ --against '.git#branch=origin/main'
fi