From 524de172d39b1dafc12577f8a2dc4f122a416cf0 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Mon, 5 Oct 2026 23:26:14 -0400 Subject: [PATCH] ci: require isolated version bumps (#303) --- .github/workflows/build.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca91945da5..8c79351ef7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,22 @@ jobs: exit 1 fi + - name: Version bumps are isolated + if: github.event_name == 'pull_request' + run: | + set -euo pipefail + git fetch --no-tags origin main + base=$(git merge-base origin/main HEAD) + diff=$(git diff -U0 "$base..HEAD" -- app/build.gradle) + grep -Eq '^[+-][[:space:]]*version(Code|Name)[[:space:]]' <<<"$diff" || exit 0 + other_files=$(git diff --name-only "$base..HEAD" | grep -v '^app/build.gradle$' || true) + other_gradle=$(grep -E '^[+-]' <<<"$diff" | grep -Ev '^(---|\+\+\+)' | grep -Ev '^[+-][[:space:]]*version(Code|Name)[[:space:]]' || true) + if [[ -n "$other_files" || -n "$other_gradle" ]]; then + echo "::error::versionCode/versionName changes must be isolated in their own PR" + echo "A version PR may only change the versionCode/versionName lines in app/build.gradle." >> "$GITHUB_STEP_SUMMARY" + exit 1 + fi + - name: Merge onto main, or say what conflicts if: github.event_name == 'pull_request' run: |