From 2b93545a4d91673166ae4f3c5a425d8df0184c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Flor=C3=AAncio?= Date: Sat, 20 Jun 2026 19:37:17 +0100 Subject: [PATCH] ci: fix opencode fork review merge base (#1451) --- .github/workflows/opencode-code-review.yml | 2 +- scripts/opencode-code-review.test.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/opencode-code-review.yml b/.github/workflows/opencode-code-review.yml index d66ae48cc4..be5b8225a2 100644 --- a/.github/workflows/opencode-code-review.yml +++ b/.github/workflows/opencode-code-review.yml @@ -286,7 +286,7 @@ jobs: REVIEW_DIR=.opencode-review rm -rf "$REVIEW_DIR" mkdir -p "$REVIEW_DIR" - git fetch --no-tags --prune --depth=1 origin "$BASE_SHA" + git fetch --no-tags --prune origin "$BASE_SHA" if [[ "$ACTION" == "synchronize" ]] && [[ -n "${BEFORE:-}" ]] && diff --git a/scripts/opencode-code-review.test.sh b/scripts/opencode-code-review.test.sh index 17b861005e..d60db34e55 100644 --- a/scripts/opencode-code-review.test.sh +++ b/scripts/opencode-code-review.test.sh @@ -46,6 +46,18 @@ if [[ "$relative_patch_count" != "2" ]]; then fi pass "OpenCode patches are passed as relative workspace files in both workflow paths" +fork_base_fetch_count="$(count_occurrences 'git fetch --no-tags --prune origin "$BASE_SHA"')" +if [[ "$fork_base_fetch_count" != "1" ]]; then + fail "Fork review fetches the trusted base commit before building the diff" +fi +pass "Fork review fetches the trusted base commit before building the diff" + +shallow_base_fetch_count="$(count_occurrences 'git fetch --no-tags --prune --depth=1 origin "$BASE_SHA"')" +if [[ "$shallow_base_fetch_count" != "0" ]]; then + fail "Fork review does not shallow-fetch the base commit before a three-dot diff" +fi +pass "Fork review does not shallow-fetch the base commit before a three-dot diff" + recreate_config_count="$(count_occurrences 'rm -rf .opencode')" if [[ "$recreate_config_count" != "2" ]]; then fail "OpenCode project config is recreated before writing the review agent"