Add draft mode support

This commit is contained in:
Tom Sherman
2023-01-25 18:23:00 +00:00
parent 595655c3ea
commit 8bd54004fb
3 changed files with 9 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@changesets/action": minor
---
Support creating the pull request in draft mode
+1
View File
@@ -109,6 +109,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
prTitle: getOptionalInput("title"), prTitle: getOptionalInput("title"),
commitMessage: getOptionalInput("commit"), commitMessage: getOptionalInput("commit"),
hasPublishScript, hasPublishScript,
createPrAsDraft: core.getBooleanInput("createPrAsDraft"),
}); });
core.setOutput("pullRequestNumber", String(pullRequestNumber)); core.setOutput("pullRequestNumber", String(pullRequestNumber));
+3
View File
@@ -251,6 +251,7 @@ type VersionOptions = {
commitMessage?: string; commitMessage?: string;
hasPublishScript?: boolean; hasPublishScript?: boolean;
prBodyMaxCharacters?: number; prBodyMaxCharacters?: number;
createPrAsDraft?: boolean;
}; };
type RunVersionResult = { type RunVersionResult = {
@@ -265,6 +266,7 @@ export async function runVersion({
commitMessage = "Version Packages", commitMessage = "Version Packages",
hasPublishScript = false, hasPublishScript = false,
prBodyMaxCharacters = MAX_CHARACTERS_PER_MESSAGE, prBodyMaxCharacters = MAX_CHARACTERS_PER_MESSAGE,
createPrAsDraft = false,
}: VersionOptions): Promise<RunVersionResult> { }: VersionOptions): Promise<RunVersionResult> {
let repo = `${github.context.repo.owner}/${github.context.repo.repo}`; let repo = `${github.context.repo.owner}/${github.context.repo.repo}`;
let branch = github.context.ref.replace("refs/heads/", ""); let branch = github.context.ref.replace("refs/heads/", "");
@@ -346,6 +348,7 @@ export async function runVersion({
head: versionBranch, head: versionBranch,
title: finalPrTitle, title: finalPrTitle,
body: prBody, body: prBody,
draft: createPrAsDraft,
...github.context.repo, ...github.context.repo,
}); });