From 1a83fc516e77dd838402ff1e7bbbada27c0d08f5 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sun, 2 Aug 2026 20:26:47 +0530 Subject: [PATCH] ci(patch): fall back to develop when the base ref has no frappe branch The Patch Test fetches the frappe repo using this erpnext PR's base branch name. For an ordinary PR that is develop, which exists in frappe/frappe. For a stacked PR the base is an erpnext feature branch with no counterpart there, so the fetch fails and the step exits 128 before any patch runs: fatal: couldn't find remote ref pg-audit/bom-amount-per-line This affects every stacked PR. It has been latent rather than absent: earlier stacks passed only because their Patch Test ran while they still targeted develop, before being retargeted onto the layer below. Fall back to develop when the base ref does not resolve. Ordinary PRs and version-branch PRs are unaffected -- their base exists in frappe, so the first fetch succeeds and the fallback never runs. --- .github/workflows/patch.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml index 83c2d7ff925..4b50c3b2043 100644 --- a/.github/workflows/patch.yml +++ b/.github/workflows/patch.yml @@ -171,7 +171,11 @@ jobs: update_to_version 16 3.14 echo "Updating to latest version" - git -C "apps/frappe" fetch --depth 1 upstream "${GITHUB_BASE_REF:-${GITHUB_REF##*/}}" + # a stacked PR's base is an erpnext feature branch with no counterpart in frappe, + # so fall back to the repository's default branch + base_ref="${GITHUB_BASE_REF:-${GITHUB_REF##*/}}" + git -C "apps/frappe" fetch --depth 1 upstream "$base_ref" \ + || git -C "apps/frappe" fetch --depth 1 upstream develop git -C "apps/frappe" checkout -q -f FETCH_HEAD git -C "apps/erpnext" checkout -q -f "$GITHUB_SHA"