Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
alert-triangle

GitHub Action

buf-breaking

v0.3.0 Pre-release

buf-breaking

alert-triangle

buf-breaking

Check that the Input location has no breaking changes compared to the "against" location.

Installation

Copy and paste the following snippet into your .yml file.

              

- name: buf-breaking

uses: bufbuild/buf-breaking-action@v0.3.0

Learn more about this action in bufbuild/buf-breaking-action

Choose a version

buf-breaking-action

Verify backwards compatibility for your Protobuf files with buf and comment in-line on pull requests.

image

Usage

Refer to the action.yml to see all of the action parameters.

The buf-breaking action requires that buf is installed in the Github Action runner, so we'll use the buf-setup action to install it.

In most cases, you'll only need to configure several variables which are referenced in the examples below. In these examples, we'll configure the action on the hypothetical https://github.com/acme/weather.git repository.

Pull requests

on: pull_request
steps:
  - uses: actions/checkout@v2
  - uses: bufbuild/buf-setup-action@v0.1.0
    with:
      version: '0.41.0'
  - uses: bufbuild/buf-breaking-action@v0.2.0
    env:
      BUF_INPUT_HTTPS_USERNAME: ${{ github.actor }}
      BUF_INPUT_HTTPS_PASSWORD: ${{ github.token }}
    with:
      against: 'https://github.com/acme/weather.git#branch=main'
      github_token: ${{ github.token }}

Push

When we configure this action on push, we often need to update the reference to check compatibility against so that we don't accidentally verify against the same commit.

For example, if we want to run the buf-breaking action for all commits pushed to the main branch, we'll need to update our against reference to refer to the previous commit, i.e. HEAD~1.

on:
  push:
    branches:
      - main
steps:
  - uses: actions/checkout@v2
  - uses: bufbuild/buf-setup-action@v0.1.0
    with:
      version: '0.41.0'
  - uses: bufbuild/buf-breaking-action@v0.2.0
    env:
      BUF_INPUT_HTTPS_USERNAME: ${{ github.actor }}
      BUF_INPUT_HTTPS_PASSWORD: ${{ github.token }}
    with:
      against: 'https://github.com/acme/weather.git#branch=main,ref=HEAD~1'
      github_token: ${{ github.token }}

Inputs

Some repositories are structured so that their buf.yaml is defined in a sub-directory alongside their Protobuf sources, such as a proto/ directory. In this case, you can specify the relative input path and the subdir option in the against reference (this is relevant for both pull_request and push).

$ tree
.
└── proto
    ├── acme
    │   └── weather
    │       └── v1
    │           └── weather.proto
    └── buf.yaml
on:
  push:
    branches:
      - main
steps:
  - uses: actions/checkout@v2
  - uses: bufbuild/buf-setup-action@v0.1.0
    with:
      version: '0.41.0'
  - uses: bufbuild/buf-breaking-action@v0.2.0
    env:
      BUF_INPUT_HTTPS_USERNAME: ${{ github.actor }}
      BUF_INPUT_HTTPS_PASSWORD: ${{ github.token }}
    with:
      input: 'proto'
      against: 'https://github.com/acme/weather.git#branch=main,ref=HEAD~1,subdir=proto'
      github_token: ${{ github.token }}

The buf-breaking action is also commonly used alongside other buf actions, such as buf-lint and buf-push.