From 406f9b42f3c121548f82373c57bcbfab1376dfad Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 1 Jan 2022 09:25:36 -0800 Subject: [PATCH] tools: remove last of error-masking in commit-queue.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the lats of the unintentional error-masking in commit-queue.sh. With this change, `tools/lint-sh.js . --from-npx` at last passes. PR-URL: https://github.com/nodejs/node/pull/41356 Reviewed-By: Luigi Pinca Reviewed-By: Tierney Cyren Reviewed-By: Zijian Liu Reviewed-By: Tobias Nießen --- tools/actions/commit-queue.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/actions/commit-queue.sh b/tools/actions/commit-queue.sh index bf6e06173c8138..16fbc7f2ef15fb 100755 --- a/tools/actions/commit-queue.sh +++ b/tools/actions/commit-queue.sh @@ -83,10 +83,14 @@ for pr in "$@"; do else # If there's only one commit, we can use the Squash and Merge feature from GitHub. # TODO: use `gh pr merge` when the GitHub CLI allows to customize the commit title (https://github.com/cli/cli/issues/1023). + commit_title=$(git log -1 --pretty='format:%s') + commit_body=$(git log -1 --pretty='format:%b') + commit_head=$(grep 'Fetched commits as' output | cut -d. -f3 | xargs git rev-parse) + jq -n \ - --arg title "$(git log -1 --pretty='format:%s')" \ - --arg body "$(git log -1 --pretty='format:%b')" \ - --arg head "$(grep 'Fetched commits as' output | cut -d. -f3 | xargs git rev-parse)" \ + --arg title "${commit_title}" \ + --arg body "${commit_body}" \ + --arg head "${commit_head}" \ '{merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' > output.json cat output.json if ! gh api -X PUT "repos/${OWNER}/${REPOSITORY}/pulls/${pr}/merge" --input output.json > output; then