Skip to content

Commit

Permalink
Add Github Workflow for checking Go API compatibility on PRs
Browse files Browse the repository at this point in the history
It'll check API compatibility for each new PR.
If the check is compatible, the label `semver:minor` will be added.
If not, `semver:major` will be used.

Now there is no way to detect whether there is an actual API change or
not (ie make a diff between `minor` and `patch`).
  • Loading branch information
EmilienM committed Aug 16, 2023
1 parent 117d6fc commit b420ef8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 21 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/semver-auto.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Add PR semver labels on push

on:
- pull_request_target:
types:
- synchronize

jobs:
go-apidiff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v2
with:
go-version: '1'

- name: Remove the semver label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: |
semver:patch
semver:minor
semver:major
github_token: ${{ github.token }}

- name: Checking Go API Compatibility
uses: joelanford/go-apidiff@main

- name: Add semver:minor label
if: ${{ success() }}
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: semver:minor

- name: Add semver:major label
if: ${{ failure() }}
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: semver:major
21 changes: 0 additions & 21 deletions .github/workflows/semver-unlabel.yaml

This file was deleted.

0 comments on commit b420ef8

Please sign in to comment.