Skip to content

Commit

Permalink
enhance(scripts/release): add pr option
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Oct 23, 2024
1 parent fd99f0e commit 79376f1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/release/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,23 @@ import {
* @param options Commit options
* @param options.branch the branch to commit to
* @param options.wait Whether to wait for user to update the release notes (used when semver bump is minor or major)
* @param options.pr PR options
* @param options.pr.title Title of the PR
* @param options.pr.body Body of the PR
*/
const commitAndPR = async (
message: string,
{
branch = 'release',
pr,
wait,
}: {
branch?: string;
wait: boolean;
pr?: {
title: string;
body: string;
};
},
): Promise<void> => {
if (wait) {
Expand All @@ -47,6 +55,11 @@ const commitAndPR = async (
const [title, ...bodyParts] = message.split('\n');
const body = bodyParts.join('\n').trim();

pr ??= {
title,
body,
};

/**
* Quotes a string.
* @param str string to quote
Expand All @@ -63,7 +76,11 @@ const commitAndPR = async (
.map((line) => `-m ${quote(line)}`)
.join(' ')}
git push --force --set-upstream origin ${branch}
<<<<<<< Updated upstream
gh pr edit ${branch} --title ${quote(title)} --body ${quote(body)}${'' /* || gh pr create --title ${quote(title)} --body ${quote(body)}*/}
=======
gh pr edit ${branch} --title ${quote(pr.title)} --body ${quote(pr.body)}${'' /* || gh pr create --title ${quote(pr.title)} --body ${quote(pr.body)}*/}
>>>>>>> Stashed changes
git switch main
git branch -d ${branch}
`);
Expand Down

0 comments on commit 79376f1

Please sign in to comment.