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 <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-27 03:41:10 +00:00
1 parent 870f8ee8c8
commit 15a196f69b
1 file changed
+5 -5
+5 -5
View File
@@ -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: