Skip to content

Commit

Permalink
Fix: clean up pr-body.txt (#162)
Browse files Browse the repository at this point in the history
Instead of having a file containing the PR body hang around on the
filesystem we can store the body string in a shell variable and pass
it as `stdin` to the `pr create` command.
  • Loading branch information
asimpson authored Jul 27, 2023
1 parent 97f88bd commit 6834fcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backport/backport.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions backport/backport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ export const getFailedBackportCommentBody = ({
if (hasBody) {
lines = lines.concat([
'# Create the PR body template',
`gh pr view ${originalNumber} --json body --template 'Backport ${commitToBackport} from #${originalNumber}{{ "\\n\\n---\\n\\n" }}{{ index . "body" }}' > .pr-body.txt`,
`PR_BODY=$(gh pr view ${originalNumber} --json body --template 'Backport ${commitToBackport} from #${originalNumber}{{ "\\n\\n---\\n\\n" }}{{ index . "body" }}')`,
`# Push the branch to GitHub and a PR`,
`gh pr create --title "${escapedTitle}" --body-file .pr-body.txt ${joinedLabels} --base ${base} --milestone ${backportMilestone} --web`,
`echo "$\{PR_BODY\}" | gh pr create --title "${escapedTitle}" --body-file - ${joinedLabels} --base ${base} --milestone ${backportMilestone} --web`, //eslint-disable-line
])
} else {
lines = lines.concat([
Expand Down

0 comments on commit 6834fcb

Please sign in to comment.