-
Notifications
You must be signed in to change notification settings - Fork 2.2k
70 lines (62 loc) · 1.97 KB
/
Copy pathapi-compatibility.yml
File metadata and controls
70 lines (62 loc) · 1.97 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This GitHub action is used to compare API state snapshots of Main
# to Head of the PR in order to validate releases are not breaking
# backwards compatibility.
#
# This GitHub action will fail if there are incompatible changes.
#
name: "Inform Incompatible PRs"
on:
pull_request:
branches:
- main
permissions: read-all
jobs:
Check-Compatibility:
runs-on: ubuntu-latest
env:
BASE_REF: ${{ github.base_ref }}
HEAD_REF: ${{ github.head_ref }}
steps:
- name: Checkout-Main
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.base_ref }}
path: ${{ github.base_ref }}
persist-credentials: false
- name: Checkout-HEAD
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: ${{ github.head_ref }}
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: oldstable
cache: false
- name: Cache Go
id: go-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }}
# Generate apidiff states of Main
- name: Generate-States
run: |
cd $BASE_REF
make apidiff-build
# Compare apidiff states of Main with PR
- name: Compare-States
env:
APIDIFF_DATA_DIR: "../${{ github.base_ref }}/internal/data/apidiff"
run: |
cd $HEAD_REF
make apidiff-compare
# Fail GitHub Action if there are incompatible changes
- name: Check-States
env:
APIDIFF_DATA_DIR: "../${{ github.base_ref }}/internal/data/apidiff"
run: |
cd $HEAD_REF
make apidiff-check