Skip to content

Commit

Permalink
fix(scripts/release): pass commit/pr body via file
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Oct 23, 2024
1 parent d5e3e05 commit eb57918
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
11 changes: 4 additions & 7 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,8 @@
"traverse": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/traverse.ts",
"update-browser-releases": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/update-browser-releases/index.ts",
"bcd": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/bulk-editor/index.ts"
},
"dependencies": {
"tempy": "^3.1.0"
}
}
22 changes: 17 additions & 5 deletions scripts/release/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import chalk from 'chalk-template';
import esMain from 'es-main';
import { temporaryFile, temporaryWriteTask } from 'tempy';

import { getSemverBumpPulls } from './semver-pulls.js';
import { getStats } from './stats.js';
Expand Down Expand Up @@ -71,12 +72,23 @@ const commitAndPR = async (
git switch main
git switch -c ${branch}
git add package.json package-lock.json RELEASE_NOTES.md
git commit ${message
.split('\n')
.map((line) => `-m ${quote(line)}`)
.join(' ')}
`);

temporaryWriteTask(message, (commitFile) =>
exec(`git commit --file ${commitFile}`),
);

exec(`
git push --force --set-upstream origin ${branch}
gh pr edit ${branch} --title ${quote(pr.title)} --body ${quote(pr.body)}${'' /* || gh pr create --title ${quote(pr.title)} --body ${quote(pr.body)}*/}
`);

temporaryWriteTask(pr.body, (bodyFile) =>
exec(
`gh pr edit ${branch} --title ${quote(pr.title)} --body-file ${bodyFile}${'' /* || gh pr create --title ${quote(pr.title)} --body-file ${bodyFile}*/}`,
),
);

exec(`
git switch main
git branch -d ${branch}
`);
Expand Down

0 comments on commit eb57918

Please sign in to comment.