mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
fix(pr): allow merge-commit landings
This commit is contained in:
@@ -72,6 +72,7 @@ Usage:
|
||||
scripts/pr prepare-run <PR>
|
||||
scripts/pr merge-verify <PR>
|
||||
scripts/pr merge-run <PR>
|
||||
OPENCLAW_PR_MERGE_METHOD=merge preserves the PR commit series.
|
||||
USAGE
|
||||
}
|
||||
|
||||
|
||||
+20
-2
@@ -233,8 +233,26 @@ merge_run() {
|
||||
return 0
|
||||
}
|
||||
|
||||
local merge_method="${OPENCLAW_PR_MERGE_METHOD:-squash}"
|
||||
local merge_flag
|
||||
local merge_label
|
||||
case "$merge_method" in
|
||||
squash)
|
||||
merge_flag="--squash"
|
||||
merge_label="squash"
|
||||
;;
|
||||
merge)
|
||||
merge_flag="--merge"
|
||||
merge_label="merge commit"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid OPENCLAW_PR_MERGE_METHOD: $merge_method (expected squash or merge)."
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! gh pr merge "$pr" \
|
||||
--squash \
|
||||
"$merge_flag" \
|
||||
--match-head-commit "$PREP_HEAD_SHA" \
|
||||
>.local/merge-output.log 2>&1
|
||||
then
|
||||
@@ -299,7 +317,7 @@ merge_run() {
|
||||
for attempt in 1 2 3; do
|
||||
if comment_output=$(
|
||||
{
|
||||
echo "Merged via squash."
|
||||
echo "Merged via $merge_label."
|
||||
echo
|
||||
echo "- Prepared head SHA: [$PREP_HEAD_SHA]($prep_sha_url)"
|
||||
echo "- Landed commit: [$landed_sha]($landed_sha_url)"
|
||||
|
||||
@@ -35,13 +35,14 @@ describe("scripts/pr wrappers", () => {
|
||||
expect(script).toContain('exec "$base" merge-run "$pr"');
|
||||
});
|
||||
|
||||
it("uses the repository-approved squash landing method", () => {
|
||||
it("defaults to squash and allows an explicit merge commit", () => {
|
||||
const script = readScript("scripts/pr-lib/merge.sh");
|
||||
|
||||
expect(script).toContain("OPENCLAW_PR_MERGE_METHOD:-squash");
|
||||
expect(script).toContain("--squash");
|
||||
expect(script).toContain("--merge");
|
||||
expect(script).not.toContain("--rebase");
|
||||
expect(script).toContain("Merged via squash.");
|
||||
expect(script).not.toContain("Merged via rebase.");
|
||||
expect(script).toContain('echo "Merged via $merge_label."');
|
||||
});
|
||||
|
||||
it("keeps prepare wrapper modes delegated to the main PR helper", () => {
|
||||
|
||||
Reference in New Issue
Block a user