Skip to content
alert-circle

GitHub Action

buf-lint

v1.1.1 Latest version

buf-lint

alert-circle

buf-lint

Check that the Input location passes lint checks.

Installation

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

              

- name: buf-lint

uses: bufbuild/[email protected]

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

Choose a version

buf-lint-action

Note

This action has been deprecated in favor of the buf-action which combines the functionality of buf-lint-action with the ability to run Buf commands in the same step. Please see the buf-action documentation for more information.

This Action enables you to lint Protobuf files with Buf in your GitHub Actions pipelines. If it detects violations of your configured lint rules, it automatically creates inline comments under the rule-breaking lines in your .proto files.

Per-line pull request comments

Usage

Here's an example usage of buf-lint-action:

on: pull_request # Apply to all pull requests
jobs:
  lint-protos:
    # Run `git checkout`
    - uses: actions/checkout@v2
    # Install the `buf` CLI
    - uses: bufbuild/buf-setup-action@v1
    # Lint your Protobuf sources
    - uses: bufbuild/buf-lint-action@v1

With this configuration, the buf CLI runs the lint checks specified in your buf.yaml configuration file. If any violations are detected, buf-lint-action creates inline comments under the rule-breaking lines in your .proto files in the pull request.

Prerequisites

For buf-lint-action to work, you need to install the buf CLI in the GitHub Actions Runner first. We recommend using buf-setup-action to install it (as in the example above).

Configuration

Parameter Description Required Default
input The path of the Buf input you want to lint check .
buf_token The Buf authentication token used for any private input

These parameters are derived from action.yml

Common tasks

Run against input in sub-directory

Some repositories are structured in such a way that their buf.yaml is defined in a sub-directory alongside their Protobuf sources, such as a proto directory. Here's an example:

$ tree
.
└── proto
    ├── acme
    │   └── weather
    │       └── v1
    │           └── weather.proto
    └── buf.yaml

In that case, you can target the proto sub-directory by setting input to proto:

steps:
  - uses: actions/checkout@v2
  - uses: bufbuild/buf-setup-action@v1
  # Run lint only in the `proto` sub-directory
  - uses: bufbuild/buf-lint-action@v1
    with:
      input: proto