This GitHub action makes it easy to run buf
within a workflow to check for
build,
lint,
format,
and breaking change errors,
as well as to automatically publish schema changes to the Buf Schema Registry (BSR).
To use this action with the recommended default behavior, create a new .github/workflows/buf-ci.yaml
file in your repository with the following content:
name: Buf CI
on:
push:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
delete:
permissions:
contents: read
pull-requests: write
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
This default configuration:
- Uses
buf push
to push named modules to the BSR when you push a Git commit, tag, or branch to GitHub. - Runs all Buf checks (
build
,lint
,format
, andbreaking
), posting a summary comment for any pull request. - Archives corresponding labels in the BSR when you delete a Git branch or tag.
For comprehensive configuration options, advanced workflows, and detailed examples, see the Buf GitHub Action Documentation.
Check out the examples directory for various workflow configurations.
If you're currently using any of our individual actions (buf-setup-action, buf-breaking-action, buf-lint-action, buf-push-action), we recommend migrating to this consolidated action that has additional capabilities. Benefits to migrating include:
- Less configuration and setup, with built-in best practices.
- Enhanced integration with Git data when pushing to the BSR.
- Status comments on pull requests.
- Easy configuration for custom behavior.
See the migration guide for more information.
To debug the action, rerun the workflow with debug logging enabled.
This will run all buf commands with the --debug
flag.
See the re-run jobs with debug logging for more information.
If you have any feedback or need support, please reach out to us on the Buf Slack, or GitHub Issues.
This action is stable and ready for production use.
Offered under the Apache 2 license.