Skip to content

Commit

Permalink
tools: remove last of error-masking in commit-queue.sh
Browse files Browse the repository at this point in the history
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: nodejs#41356
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
Trott authored and Linkgoron committed Jan 31, 2022
1 parent adef7e4 commit 406f9b4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/actions/commit-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 406f9b4

Please sign in to comment.