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
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: tools/actions/commit-queue.sh +9-13Lines changed: 9 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -87,22 +87,18 @@ for pr in "$@"; do |
87 | 87 | commit_body=$(git log -1 --pretty='format:%b') |
88 | 88 | commit_head=$(grep 'Fetched commits as' output | cut -d. -f3 | xargs git rev-parse) |
89 | 89 |
|
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 |
97 | 99 | commit_queue_failed "$pr" |
98 | 100 | continue |
99 | 101 | 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 |
106 | 102 | fi |
107 | 103 |
|
108 | 104 | rm output |
|
Collapse file
Copy file name to clipboardExpand all lines: tools/actions/merge.sh +7-17Lines changed: 7 additions & 17 deletions | 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 |
39 | 39 | commit_title=$(git log -1 --pretty='format:%s') |
40 | 40 | commit_body=$(git log -1 --pretty='format:%b') |
41 | 41 |
|
42 | | -jq -n \ |
| 42 | +commitSHA="$( |
| 43 | + jq -cn \ |
43 | 44 | --arg title "${commit_title}" \ |
44 | 45 | --arg body "${commit_body}" \ |
45 | 46 | --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 | +)" |
61 | 51 |
|
62 | | -gh pr comment "$pr" --repo "$OWNER/$REPOSITORY" --body "Landed in $commits" |
| 52 | +gh pr comment "$pr" --repo "$OWNER/$REPOSITORY" --body "Landed in $commitSHA" |