Skip to content

Commit 9af5793

Browse files
committed
tools: use github cli to squash the pr
1 parent 93644d5 commit 9af5793

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

tools/actions/commit-queue.sh

+1-9
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,11 @@ for pr in "$@"; do
8282
fi
8383
else
8484
# If there's only one commit, we can use the Squash and Merge feature from GitHub.
85-
# TODO: use `gh pr merge` when the GitHub CLI allows to customize the commit title (https://github.com/cli/cli/issues/1023).
8685
commit_title=$(git log -1 --pretty='format:%s')
8786
commit_body=$(git log -1 --pretty='format:%b')
8887
commit_head=$(grep 'Fetched commits as' output | cut -d. -f3 | xargs git rev-parse)
8988

90-
jq -n \
91-
--arg title "${commit_title}" \
92-
--arg body "${commit_body}" \
93-
--arg head "${commit_head}" \
94-
'{merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' > output.json
95-
cat output.json
96-
if ! gh api -X PUT "repos/${OWNER}/${REPOSITORY}/pulls/${pr}/merge" --input output.json > output; then
89+
if ! gh pr merge "$pr" --squash --body "$commit_body" --subject "$commit_title" --match-head-commit "$commit_head" --admin > output; then
9790
commit_queue_failed "$pr"
9891
continue
9992
fi
@@ -102,7 +95,6 @@ for pr in "$@"; do
10295
commit_queue_failed "$pr"
10396
continue
10497
fi
105-
rm output.json
10698
fi
10799

108100
rm output

0 commit comments

Comments
 (0)