Skip to content

Commit abef69c

Browse files
committed
tools: use github cli to squash the pr
1 parent ca74d64 commit abef69c

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

tools/actions/commit-queue.sh

Lines changed: 1 addition & 8 deletions
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" > output; then
9790
commit_queue_failed "$pr"
9891
continue
9992
fi

0 commit comments

Comments
 (0)