This repository has been archived by the owner on Sep 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
50 lines (49 loc) · 1.69 KB
/
go-compat.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
48
49
50
on: pull_request
name: Go Compat
jobs:
unit:
runs-on: ubuntu-latest
name: API Compatibility
env:
GOCOMPAT: ""
steps:
- uses: actions/checkout@v2
- name: Fetching merge base
run: git fetch --depth=1 origin "$GITHUB_BASE_REF"
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Go information
run: |
go version
go env
- name: Install Compat Check
run: go install github.com/smola/gocompat/cmd/gocompat@8498b97a44792a3a6063c47014726baa63e2e669 # 2021.7 (v0.3.0)
- name: Check Compatibility
run: |
status=0
output=$(gocompat compare --go1compat --git-refs="$GITHUB_BASE_REF..$GITHUB_SHA" ./...) || status=$?
if [[ $status != 0 ]]; then
echo "incompatible"
# dealing with multi-line strings in GitHub Actions is a pain
echo "GOCOMPAT<<EOF" >> $GITHUB_ENV
echo "$output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
fi
- name: Post a comment
uses: marocchino/sticky-pull-request-comment@82e7a0d3c51217201b3fedc4ddde6632e969a477 # v2.1.1
if: env.GOCOMPAT != ''
with:
header: gocompat-comment
recreate: true
message: |
`gocompat` says:
```
${{ env.GOCOMPAT }}
```
- name: Delete previous comment # if new commits were added that reverted an incompatible change, delete the comment
uses: marocchino/sticky-pull-request-comment@82e7a0d3c51217201b3fedc4ddde6632e969a477 # v2.1.1
if: env.GOCOMPAT == ''
with:
header: gocompat-comment
delete: true