mirror bufbuild/buf-action@v1.1.1
Buf action CI / build (push) Canceled after 0s
Buf action CI / test-setup (push) Canceled after 0s
Buf action CI / test-setup-latest (push) Canceled after 0s
Buf action CI / test-setup-macos (push) Canceled after 0s
Buf action CI / test-setup-windows (push) Canceled after 0s
Buf action CI / test-setup-self-hosted (push) Canceled after 0s
Buf action CI / test-empty-build (push) Canceled after 0s
Buf action CI / test-lint (push) Canceled after 0s
Buf action CI / test-format (push) Canceled after 0s
Buf action CI / test-breaking (push) Canceled after 0s
Buf action CI / test-comment (push) Canceled after 0s
Buf action CI / test-push (push) Canceled after 0s
Buf action CI / test-push-token-only (push) Canceled after 0s
Buf action CI / test-push-unnamed (push) Canceled after 0s
Buf action CI / test-archive (push) Canceled after 0s
Buf action CI / test-archive-root (push) Canceled after 0s
Buf action CI / test-archive-unnamed (push) Canceled after 0s

This commit is contained in:
action-mirror committed 2026-11-09 01:03:09 +08:00
commit 38d0d7e18f
50 files changed
+85157

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
# Examples
This directory contains examples of how to use the `buf` GitHub Action.
## Workflows
- [buf-ci.yaml](./buf-ci.yaml): Recommended configuration for using `buf` in a CI environment.
- [only-checks/buf-ci.yaml](./only-checks/buf-ci.yaml): How to use `buf` to only run checks on pull requests.
- [only-setup/buf-ci.yaml](./only-setup/buf-ci.yaml): How to use `buf` to only install `buf`.
- [only-setup-defaults/buf-ci.yaml](./only-setup-defaults/buf-ci.yaml): Showcases the default steps of the `buf` action.
- [only-sync/buf-ci.yaml](./only-sync/buf-ci.yaml): How to use `buf` to only sync the repository labels.
- [push-on-changes/buf-ci.yaml](./push-on-changes/buf-ci.yaml): Pushes changes only on detecting protobuf file changes.
- [skip-on-commits/buf-ci.yaml](./skip-on-commits/buf-ci.yaml): How to use commit messages to skip `buf` checks on push.
- [skip-on-labels/buf-ci.yaml](./skip-on-labels/buf-ci.yaml): How to use custom labels to skip `buf` checks on pull requests.
- [validate-push/buf-ci.yaml](./validate-push/buf-ci.yaml): Validate checks before pushing to the repository.
- [version-env/buf-ci.yaml](./version-env/buf-ci.yaml): Resolve the `buf` version from an environment variable (`BUF_VERSION`).
- [version-input/buf-ci.yaml](./version-input/buf-ci.yaml): Resolve the `buf` version from an action input (`version`).
- [version-latest/buf-ci.yaml](./version-latest/buf-ci.yaml): Use the latest `buf` version.
+18
View File
@@ -0,0 +1,18 @@
# This is a GitHub Actions workflow file that uses the buf-action to run Buf CI.
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 }}
+22
View File
@@ -0,0 +1,22 @@
# This workflow runs checks before pushing to the BSR.
name: Buf CI
on:
push:
delete:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
lint: ${{ github.event_name == 'push' }}
format: ${{ github.event_name == 'push' }}
breaking: ${{ github.event_name == 'push' && !contains(github.event.head_commit.message, 'buf skip breaking') }}
# Specify the branch to compare against for breaking change detection.
# The default for push is to compare to the commit before. We want to
# compare against the main branch for a GitHub flow style workflow.
breaking_against: .git#branch=main
+21
View File
@@ -0,0 +1,21 @@
# This workflow disables the use of labels for skipping checks. It does this by
# removing the expressions that check for the presence of the 'buf skip' labels.
# As a result, the pull_request types for labeled and unlabeled events can now
# also be removed (NB: the 'pull_request' default event types include opened,
# synchronize, and reopened).
name: Buf CI
on:
push:
pull_request:
delete:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
breaking: ${{ github.event_name == 'pull_request' }}
+22
View File
@@ -0,0 +1,22 @@
# This workflow shows the default configuration for GitHub Enterprise Server.
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 }}
# Specify the public GitHub token to authenticate requests to github.com.
# This is required when running on a private GitHub Enterprise instance.
# Will be used when resolving buf versions and downloading buf binaries.
public_github_token: ${{ secrets.PUBLIC_GITHUB_TOKEN }}
+14
View File
@@ -0,0 +1,14 @@
# This workflow runs checks on pull_requests only, without push and archive steps.
name: Buf CI
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
permissions:
contents: read
pull-requests: write
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
+35
View File
@@ -0,0 +1,35 @@
# This file showcases the Buf CI workflow in a step by step breakdown.
# Based on the buf-ci.yaml file, this action walks through the Buf CI workflow
# and shows what each step does.
name: Buf CI
on:
push:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
delete:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
setup_only: true
- env:
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
run: echo ${BUF_TOKEN} | buf registry login buf.build --token-stdin
- run: buf build --error-format=github-actions
- if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'buf skip lint') }}
run: buf lint --error-format github-actions
- if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'buf skip format') }}
run: buf format --diff --error-format github-actions --exit-code
- if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'buf skip breaking') }}
run: |
buf breaking --error-format github-actions --against \
${{ github.event.repository.clone_url }}#format=git,tag=${{ github.event.pull_request.base.sha || github.event.before }}
- if: ${{ github.event_name == 'push' }}
run: buf push --error-format github-actions --create --git-metadata
- if: ${{ github.event_name == 'delete' }}
run: buf beta registry archive --label ${{ github.ref_name }}
+18
View File
@@ -0,0 +1,18 @@
# This file is used to setup the Buf CLI in the GitHub Actions environment.
# After the buf-action is run, the Buf CLI is available for use in subsequent steps.
name: Buf CI
on:
push:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
# Add the parameter token as a secret in your repository settings
# to authenticate with the Buf Schema Registry.
setup_only: true
- run: buf build --error-format=github-actions
+15
View File
@@ -0,0 +1,15 @@
# This workflow syncs the changes to the BSR without running any checks.
name: Buf CI
on:
push:
delete:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
+24
View File
@@ -0,0 +1,24 @@
# This workflow shows syncing changes only when the buf.yaml, README.md, LICENSE
# or .proto files are modified.
# Caution: Restricting push can cause unintended behavior. Review the paths carefully.
name: Buf CI
on:
push:
paths:
# Caution: This workflow could miss changes if the paths are not correctly specified.
- '**.proto'
- '**/buf.yaml'
- '**/buf.lock'
- '**/buf.md'
- '**/README.md'
- '**/LICENSE'
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
+18
View File
@@ -0,0 +1,18 @@
# This workflow skips checks when `buf skip` is used in the commit message.
name: Buf CI
on:
push:
delete:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
lint: ${{ github.event_name == 'push' && !contains(github.event.head_commit.message, 'buf skip lint') }}
format: ${{ github.event_name == 'push' && !contains(github.event.head_commit.message, 'buf skip format') }}
breaking: ${{ github.event_name == 'push' && !contains(github.event.head_commit.message, 'buf skip breaking') }}
+20
View File
@@ -0,0 +1,20 @@
# This workflow skips checks when `buf skip` is applied to a PR.
name: Buf CI
on:
push:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
delete:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
lint: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'buf skip lint') }}
format: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'buf skip format') }}
breaking: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'buf skip breaking') }}
+19
View File
@@ -0,0 +1,19 @@
# This workflow runs checks on push events before pushing the changes to the BSR.
name: Buf CI
on:
push:
delete:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
# The token paramater is required to authenticate with the Buf Schema Registry.
token: ${{ secrets.BUF_TOKEN }}
lint: ${{ github.event_name == 'push' }}
format: ${{ github.event_name == 'push' }}
breaking: ${{ github.event_name == 'push' }}
+17
View File
@@ -0,0 +1,17 @@
# This workflow downloads the version of buf specified in the env var $BUF_VERSION.
name: Buf CI
on:
push:
permissions:
contents: read
env:
BUF_VERSION: "1.32.0"
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
setup_only: true
- run: buf version
+16
View File
@@ -0,0 +1,16 @@
# This workflow downloads the version of buf specified in the action input.
name: Buf CI
on:
push:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
setup_only: true
version: 1.50.1
- run: buf version
+15
View File
@@ -0,0 +1,15 @@
# This workflow downloads the latest version of buf as none is specified.
name: Buf CI
on:
push:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
setup_only: true
- run: buf version