From 274a1841357262344118f430158dd00bc80c7729 Mon Sep 17 00:00:00 2001 From: riccardom Date: Thu, 21 May 2026 10:11:53 +0200 Subject: [PATCH] Detect untracked files in proto drift gate CodeRabbit: git diff --exit-code ignores untracked .pb.go files, so adding a new .proto without committing its generated output would slip through the gate. Use git status --porcelain --untracked-files=all to catch both modified and untracked drift. Also align [[ ]] usage in protoc version preflight. --- .github/workflows/proto-version-check.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/proto-version-check.yml b/.github/workflows/proto-version-check.yml index 34338abd8..37ed21f18 100644 --- a/.github/workflows/proto-version-check.yml +++ b/.github/workflows/proto-version-check.yml @@ -47,7 +47,7 @@ jobs: - name: Verify protoc version matches pin run: | actual=$(protoc --version | awk '{print $2}') - if [ "$actual" != "$PROTOC_VERSION" ]; then + if [[ "$actual" != "$PROTOC_VERSION" ]]; then echo "::error::protoc $actual does not match pinned $PROTOC_VERSION" exit 1 fi @@ -66,10 +66,11 @@ jobs: echo "::endgroup::" done - - name: Fail if regeneration changed any tracked file + - name: Fail if regeneration changed any tracked or untracked file run: | - if ! git diff --exit-code; then + if [[ -n "$(git status --porcelain --untracked-files=all)" ]]; then echo "::error::Generated proto files drift from .proto sources or pinned tool versions." echo "Run the generate.sh scripts locally with the toolchain in proto-tools.env and commit the result." + git status --short exit 1 fi