diff --git a/sh/gh/back-merge.sh b/sh/gh/back-merge.sh index 3021f3e318..2a7142b42f 100755 --- a/sh/gh/back-merge.sh +++ b/sh/gh/back-merge.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash # -# Open (or refresh) the pull request that merges `release` back into `main`, -# and queue it to land as a merge commit once Check and Test pass. +# Open (or refresh) the pull request that merges `release` back into `main`. +# Check's `land` job merges it as a merge commit once Check and Test pass on its +# head, bypassing the squash-only merge queue. # # The pull request's head is its own branch rather than `release` itself: the # repository deletes head branches on merge, and a conflict is resolved by @@ -45,25 +46,12 @@ esac # Only a pull request from this repository's own branch: `gh pr list --head` # matches the branch name alone, so a fork's branch of the same name would pass. -find_pr() { - gh api "repos/$repo/pulls?state=open&base=main&head=${repo%%/*}:$branch" \ - --jq "[.[] | select(.head.repo.full_name == \"$repo\")][0].number // empty" -} - -pr=$(find_pr) +pr=$(gh api "repos/$repo/pulls?state=open&base=main&head=${repo%%/*}:$branch" \ + --jq "[.[] | select(.head.repo.full_name == \"$repo\")][0].number // empty") if [[ -z "$pr" ]]; then gh pr create --repo "$repo" --head "$branch" --base main \ --title "chore: merge release into main" \ --body "Carries what \`release\` published (versions, CHANGELOGs, backports) back to trunk. Opened by the Back-merge workflow. -**Merge with a merge commit. Never squash.** A squash leaves the merge base at the last cut, so the next back-merge conflicts. On a conflict, merge \`main\` into \`$branch\` and resolve it there." - pr=$(find_pr) -fi -if [[ -z "$pr" ]]; then - echo "error: no pull request from $repo:$branch into main" >&2 - exit 1 +Check's \`land\` job merges it as a merge commit once Check and Test pass. **Never squash.** A squash leaves the merge base at the last cut, so the next back-merge conflicts. On a conflict, merge \`main\` into \`$branch\` and resolve it there." fi - -# Queue exactly the commit this run produced, so a later push cannot ride along. -head=$(gh api "repos/$repo/git/ref/heads/$branch" --jq .object.sha) -gh pr merge --repo "$repo" "$pr" --auto --merge --match-head-commit "$head"