From 15a196f69ba9571154f42507de01dd61648de3a5 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 27 Jan 2026 03:41:10 +0000 Subject: [PATCH] fix(ci): robustly verify upstream branch in PR review workflow Replaces `git rev-parse` with `git ls-remote` to verify the existence of the upstream base branch before attempting to fetch and diff. This prevents workflow failures when the PR targets a branch that does not exist on the upstream remote (e.g. `unstable` or other feature branches), gracefully skipping the diff step with a warning instead. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- .github/workflows/agent-pr-review.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/agent-pr-review.yml b/.github/workflows/agent-pr-review.yml index ec3ae661..b010a79b 100644 --- a/.github/workflows/agent-pr-review.yml +++ b/.github/workflows/agent-pr-review.yml @@ -36,12 +36,12 @@ jobs: - name: Verify upstream branch and diff run: | - if ! git rev-parse --verify upstream/${{ github.base_ref }} >/dev/null 2>&1; then - echo "::error::Branch upstream/${{ github.base_ref }} not found." - exit 1 + if git ls-remote --heads upstream "${{ github.base_ref }}" | grep "${{ github.base_ref }}" > /dev/null; then + git fetch upstream "${{ github.base_ref }}" + git diff --name-only upstream/${{ github.base_ref }}...HEAD + else + echo "::warning::Branch upstream/${{ github.base_ref }} not found. Skipping diff." fi - # Verify we can diff against it - git diff --name-only upstream/${{ github.base_ref }}...HEAD - name: Run Agent Review env: