Files
netbird/.github/workflows/buf.yml
Brad Ison 798e4a0546 [misc] Skip the protobuf breaking check on branch-creation pushes (#7411)
A push that creates a branch sends the all-zero SHA as `before`, and
bufbuild/buf-action unconditionally builds its default baseline from
it:(src/inputs.ts:86), so `buf breaking` failed cloning a ref that does
not exist. This broke the first run on every new release-* branch, most
recently release-0.78.

Gate `breaking` on github.event.created instead. Nothing is lost: every
commit on a freshly cut release branch already passed the check on main,
and pushes with a real `before` -- plus pull requests, which compare
against their own base -- keep the action's own default baseline, so
stacked PRs are unaffected.

Also drop `build: false`, which is not an input this action accepts and
only produced a warning.
2026-09-03 16:44:18 +02:00

49 lines
1.7 KiB
YAML

name: protobuf checks
on:
push:
branches:
- main
- "release-*"
pull_request:
paths:
- ".github/workflows/buf.yml"
- "**/buf.yaml"
- "**/buf.lock"
- "**/buf.gen.yaml"
- "**.proto"
permissions:
contents: read
pull-requests: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: bufbuild/buf-action@8c6a16e16f12ba20b6470afa9c2ba9b5ba8c97c3 # v1.5.0
with:
push: false
archive: false
pr_comment: false
lint: false
format: false
# A push that creates a branch carries no `before` commit, so the
# action's default baseline is the all-zero SHA and `buf breaking`
# dies cloning it. Skipping costs nothing: every commit on a freshly
# cut release branch should have already passed this check on main.
breaking: ${{ !github.event.created }}
# The alternative is to compare against the default branch instead of
# skipping. Not used: buf clones the baseline when the job runs, so a
# main that has moved on since the branch was cut reads as protos
# deleted on the release branch. Resolving to an empty string on every
# other event is what keeps the action's own default in place, which
# stacked pull requests need.
# breaking_against: >-
# ${{ github.event.created
# && format('{0}#format=git,branch={1}',
# github.event.repository.clone_url,
# github.event.repository.default_branch)
# || '' }}