https://github.com/bufbuild/buf-lint-action
https://github.com/bufbuild/buf-lint-action
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bufbuild/buf-lint-action
- Owner: bufbuild
- License: apache-2.0
- Created: 2021-03-17T20:38:24.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-24T16:45:48.000Z (over 1 year ago)
- Last Synced: 2025-06-03T23:23:00.392Z (about 1 year ago)
- Language: TypeScript
- Size: 1.67 MB
- Stars: 28
- Watchers: 16
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `buf-lint-action`
> [!NOTE]
> This action has been deprecated in favor of the [`buf-action`][buf-action] which combines the
> functionality of `buf-lint-action` with the ability to run Buf commands in the same step. Please
> see the [migration guide][buf-action-migration] 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][lint.rules], it automatically creates inline
comments under the rule-breaking lines in your `.proto` files.

## Usage
Here's an example usage of `buf-lint-action`:
```yaml
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`][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`][buf-setup] to install it (as in the example
[above](#usage)).
## Configuration
Parameter | Description | Required | Default
:---------|:------------|:---------|:-------
`input` | The path of the [Buf input][input] you want to lint check | | `.`
`buf_token` | The Buf [authentication token][token] used for any private [input] | ✅ |
> These parameters are derived from [`action.yml`](./action.yml)
## Common tasks
### Run against input in sub-directory
Some repositories are structured in such a way that their [`buf.yaml`][buf-yaml] is defined in a
sub-directory alongside their Protobuf sources, such as a `proto` directory. Here's an example:
```sh
$ tree
.
└── proto
├── acme
│ └── weather
│ └── v1
│ └── weather.proto
└── buf.yaml
```
In that case, you can target the `proto` sub-directory by setting `input` to `proto`:
```yaml
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
```
[action]: https://docs.github.com/actions
[buf-action]: https://github.com/bufbuild/buf-action
[buf-action-migration]: https://github.com/bufbuild/buf-action/blob/main/MIGRATION.md#buf-lint-action
[buf]: https://buf.build
[buf-breaking]: https://github.com/marketplace/actions/buf-breaking
[buf-push]: https://github.com/marketplace/actions/buf-push
[buf-setup]: https://github.com/bufbuild/buf-setup-action
[buf-yaml]: https://docs.buf.build/configuration/v1/buf-yaml
[input]: https://docs.buf.build/reference/inputs
[lint]: https://docs.buf.build/lint/usage
[lint.rules]: https://docs.buf.build/lint/rules
[token]: https://docs.buf.build/bsr/authentication#create-an-api-token