GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tools: do not use temp files when merging PRs · nodejs/node@c99a184

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tools/actions
    • commit-queue.sh
    • merge.sh
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tools/actions/commit-queue.sh‎

Copy file name to clipboardExpand all lines: tools/actions/commit-queue.sh
+9-13Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff 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
Collapse file

‎tools/actions/merge.sh‎

Copy file name to clipboardExpand all lines: tools/actions/merge.sh
+7-17Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,14 @@ git log -1 HEAD^ --pretty='format:%B' | git interpret-trailers --parse --no-divi
3939
commit_title=$(git log -1 --pretty='format:%s')
4040
commit_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"

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.