forked from googleapis/go-genproto
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (43 loc) · 1.32 KB
/
apidiff.yaml
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
---
name: apidiff
on:
pull_request:
jobs:
apidiff:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'breaking change allowed')"
steps:
- uses: actions/checkout@v3
with:
ref: main
- uses: actions/setup-go@v3
with:
go-version: '1.18.3'
- name: Install latest apidiff
run: go install golang.org/x/exp/cmd/apidiff@latest
- name: Create Go package baseline
run: apidiff -w pkg.main ./...
- name: Upload baseline package data
uses: actions/upload-artifact@v3
with:
name: pkg.main
path: pkg.main
retention-days: 1
- uses: actions/checkout@v3
- name: Download baseline package data
uses: actions/download-artifact@v3
with:
name: pkg.main
- name: Compare regenerated code to baseline
run: apidiff -incompatible pkg.main ./... > diff.txt && cat diff.txt && ! [ -s diff.txt ]
- name: Add breaking change label
if: ${{ failure() && !github.event.pull_request.head.repo.fork }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.addLabels({
issue_number: ${{ github.event.number }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['breaking change']
})