Skip to content

Commit 62a1e77

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

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Diff for: tools/actions/commit-queue.sh

+2-10
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,10 @@ 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')
88-
commit_head=$(grep 'Fetched commits as' output | cut -d. -f3 | xargs git rev-parse)
89-
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
87+
88+
if ! gh pr merge "$pr" --squash --body "$commit_body" --subject "$commit_title" > output; then
9789
commit_queue_failed "$pr"
9890
continue
9991
fi

0 commit comments

Comments
 (0)