From 9c4124706eb81f745f9046a9e3f04203b673434d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 27 Dec 2021 06:48:07 -0800 Subject: [PATCH] tools: simplify commit-queue.sh merge command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mergeUrl() function is only used in one place. It's a one-liner and inlining it makes the script easier to understand, I think. It also means no future shellcheck complaints about needing to add error handling. PR-URL: https://github.com/nodejs/node/pull/41314 Reviewed-By: Luigi Pinca Reviewed-By: Antoine du Hamel Reviewed-By: Gerhard Stöbich --- tools/actions/commit-queue.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/actions/commit-queue.sh b/tools/actions/commit-queue.sh index 8ffbf9ea8d9da4..bb231c6a0b9b84 100755 --- a/tools/actions/commit-queue.sh +++ b/tools/actions/commit-queue.sh @@ -12,10 +12,6 @@ DEFAULT_BRANCH=master COMMIT_QUEUE_LABEL="commit-queue" COMMIT_QUEUE_FAILED_LABEL="commit-queue-failed" -mergeUrl() { - echo "repos/${OWNER}/${REPOSITORY}/pulls/${1}/merge" -} - commit_queue_failed() { pr=$1 @@ -91,7 +87,7 @@ for pr in "$@"; do --arg head "$(grep 'Fetched commits as' output | cut -d. -f3 | xargs git rev-parse)" \ '{merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' > output.json cat output.json - if ! gh api -X PUT "$(mergeUrl "$pr")" --input output.json > output; then + if ! gh api -X PUT "repos/${OWNER}/${REPOSITORY}/pulls/${pr}/merge" --input output.json > output; then commit_queue_failed "$pr" continue fi