tools: do not use temp files when merging PRs
PR-URL: https://github.com/nodejs/node/pull/57790 Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
f03e90a0df
commit
d5b3dbb0f5
@ -87,22 +87,18 @@ for pr in "$@"; do
|
|||||||
commit_body=$(git log -1 --pretty='format:%b')
|
commit_body=$(git log -1 --pretty='format:%b')
|
||||||
commit_head=$(grep 'Fetched commits as' output | cut -d. -f3 | xargs git rev-parse)
|
commit_head=$(grep 'Fetched commits as' output | cut -d. -f3 | xargs git rev-parse)
|
||||||
|
|
||||||
jq -n \
|
if ! commits="$(
|
||||||
--arg title "${commit_title}" \
|
jq -cn \
|
||||||
--arg body "${commit_body}" \
|
--arg title "${commit_title}" \
|
||||||
--arg head "${commit_head}" \
|
--arg body "${commit_body}" \
|
||||||
'{merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' > output.json
|
--arg head "${commit_head}" \
|
||||||
cat output.json
|
'{merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' |\
|
||||||
if ! gh api -X PUT "repos/${OWNER}/${REPOSITORY}/pulls/${pr}/merge" --input output.json > output; then
|
gh api -X PUT "repos/${OWNER}/${REPOSITORY}/pulls/${pr}/merge" --input -\
|
||||||
|
--jq 'if .merged then .sha else halt_error end'
|
||||||
|
)"; then
|
||||||
commit_queue_failed "$pr"
|
commit_queue_failed "$pr"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
cat output
|
|
||||||
if ! commits="$(jq -r 'if .merged then .sha else error("not merged") end' < output)"; then
|
|
||||||
commit_queue_failed "$pr"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
rm output.json
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm output
|
rm output
|
||||||
|
@ -39,24 +39,14 @@ git log -1 HEAD^ --pretty='format:%B' | git interpret-trailers --parse --no-divi
|
|||||||
commit_title=$(git log -1 --pretty='format:%s')
|
commit_title=$(git log -1 --pretty='format:%s')
|
||||||
commit_body=$(git log -1 --pretty='format:%b')
|
commit_body=$(git log -1 --pretty='format:%b')
|
||||||
|
|
||||||
jq -n \
|
commitSHA="$(
|
||||||
|
jq -cn \
|
||||||
--arg title "${commit_title}" \
|
--arg title "${commit_title}" \
|
||||||
--arg body "${commit_body}" \
|
--arg body "${commit_body}" \
|
||||||
--arg head "${commit_head}" \
|
--arg head "${commit_head}" \
|
||||||
'{merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' > output.json
|
'{merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' |\
|
||||||
cat output.json
|
gh api -X PUT "repos/${OWNER}/${REPOSITORY}/pulls/${pr}/merge" --input -\
|
||||||
if ! gh api -X PUT "repos/${OWNER}/${REPOSITORY}/pulls/${pr}/merge" --input output.json > output; then
|
--jq 'if .merged then .sha else halt_error end'
|
||||||
cat output
|
)"
|
||||||
echo "Failed to merge $pr"
|
|
||||||
rm output output.json
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cat output
|
|
||||||
if ! commits="$(jq -r 'if .merged then .sha else error("not merged") end' < output)"; then
|
|
||||||
echo "Failed to merge $pr"
|
|
||||||
rm output output.json
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm output.json output
|
|
||||||
|
|
||||||
gh pr comment "$pr" --repo "$OWNER/$REPOSITORY" --body "Landed in $commits"
|
gh pr comment "$pr" --repo "$OWNER/$REPOSITORY" --body "Landed in $commitSHA"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user