Skip to content

Commit 3e0071f

Browse files
committed
workflow/semver-auto: rebase PR
When testing if a PR is API backward compatible or not, we need to test against the base branch, not the head against the PR branched is based on. Otherwise it can lead to the case where a breaking change was merged after that a PR was proposed, go-apidiff will fail because it'll test the repo against base_ref. The PR needs to be rebased on base_ref so the actual compatibility can be verified. If the PR can't be rebase for any reason, we'll return a failure and add the label `semver:unknown`.
1 parent a6cf357 commit 3e0071f

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

.github/labels.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@
1919
- color: '6E7624'
2020
description: No API change
2121
name: semver:patch
22+
- color: 'EC0101'
23+
description: Unable to figure out the semver type
24+
name: semver:unknown

.github/workflows/semver-auto.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ jobs:
1212
ref: ${{ github.event.pull_request.head.sha }}
1313
token: ${{ secrets.GITHUB_TOKEN }}
1414

15+
- uses: peter-evans/rebase@56c359b35ff7ba8426d0fdb842958b35b1db827
16+
with:
17+
base: ${{ github.base_ref }}
18+
19+
- name: Add semver:unknown label
20+
if: failure()
21+
uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
labels: semver:unknown
25+
1526
- uses: actions/setup-go@v4
1627
with:
1728
go-version: '1'
@@ -23,6 +34,7 @@ jobs:
2334
semver:patch
2435
semver:minor
2536
semver:major
37+
semver:unknown
2638
github_token: ${{ secrets.GITHUB_TOKEN }}
2739

2840
- name: Checking Go API Compatibility

0 commit comments

Comments
 (0)