Skip to content

bufbuild/buf-lint-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b838cb4 · Aug 1, 2024

History

40 Commits
Feb 22, 2024
Feb 20, 2024
Feb 20, 2024
Jul 22, 2021
Feb 20, 2024
Jun 27, 2022
Feb 20, 2024
Jun 24, 2022
Feb 20, 2024
Feb 20, 2024
Aug 1, 2024
Feb 20, 2024
Feb 20, 2024
Feb 20, 2024
Mar 17, 2021

Repository files navigation

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