Skip to content

cheddar-me/buf-lint-action

 
 

Repository files navigation

buf-lint-action

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 78.4%
  • Makefile 13.2%
  • JavaScript 8.4%