File tree Expand file tree Collapse file tree 2 files changed +16
-30
lines changed Expand file tree Collapse file tree 2 files changed +16
-30
lines changed Original file line number Diff line number Diff line change @@ -87,22 +87,18 @@ for pr in "$@"; do
8787 commit_body=$( git log -1 --pretty=' format:%b' )
8888 commit_head=$( grep ' Fetched commits as' output | cut -d. -f3 | xargs git rev-parse)
8989
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
90+ if ! commits=" $(
91+ jq -cn \
92+ --arg title " ${commit_title} " \
93+ --arg body " ${commit_body} " \
94+ --arg head " ${commit_head} " \
95+ ' {merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' | \
96+ gh api -X PUT " repos/${OWNER} /${REPOSITORY} /pulls/${pr} /merge" --input -\
97+ --jq ' if .merged then .sha else halt_error end'
98+ ) " ; then
9799 commit_queue_failed " $pr "
98100 continue
99101 fi
100- cat output
101- if ! commits=" $( jq -r ' if .merged then .sha else error("not merged") end' < output) " ; then
102- commit_queue_failed " $pr "
103- continue
104- fi
105- rm output.json
106102 fi
107103
108104 rm output
Original file line number Diff line number Diff line change @@ -39,24 +39,14 @@ git log -1 HEAD^ --pretty='format:%B' | git interpret-trailers --parse --no-divi
3939commit_title=$( git log -1 --pretty=' format:%s' )
4040commit_body=$( git log -1 --pretty=' format:%b' )
4141
42- jq -n \
42+ commitSHA=" $(
43+ jq -cn \
4344 --arg title " ${commit_title} " \
4445 --arg body " ${commit_body} " \
4546 --arg head " ${commit_head} " \
46- ' {merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' > output.json
47- cat output.json
48- if ! gh api -X PUT " repos/${OWNER} /${REPOSITORY} /pulls/${pr} /merge" --input output.json > output; then
49- cat output
50- echo " Failed to merge $pr "
51- rm output output.json
52- exit 1
53- fi
54- cat output
55- if ! commits=" $( jq -r ' if .merged then .sha else error("not merged") end' < output) " ; then
56- echo " Failed to merge $pr "
57- rm output output.json
58- exit 1
59- fi
60- rm output.json output
47+ ' {merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' | \
48+ gh api -X PUT " repos/${OWNER} /${REPOSITORY} /pulls/${pr} /merge" --input -\
49+ --jq ' if .merged then .sha else halt_error end'
50+ ) "
6151
62- gh pr comment " $pr " --repo " $OWNER /$REPOSITORY " --body " Landed in $commits "
52+ gh pr comment " $pr " --repo " $OWNER /$REPOSITORY " --body " Landed in $commitSHA "
You can’t perform that action at this time.
0 commit comments