Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gihub-release-draft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---

Add GitHub Release Draft support
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ inputs:
description: "Whether to create Github releases after publish"
required: false
default: true
github-releases-draft:
description: "Controls draft Release behavior."
required: false
default: false
push-git-tags:
description: >
Whether to create git tags after publish. If `create-github-releases` is set to `true`,
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import {
const createGithubReleases = core.getBooleanInput(
"create-github-releases",
);
const githubReleasesDraft = core.getBooleanInput("github-releases-draft");
const pushGitTags = core.getBooleanInput("push-git-tags");
if (createGithubReleases && !pushGitTags) {
throw new Error(
Expand All @@ -86,6 +87,7 @@ import {
script: publishScript,
github,
createGithubReleases,
githubReleasesDraft,
pushGitTags,
cwd,
});
Expand Down
11 changes: 9 additions & 2 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const MAX_CHARACTERS_PER_MESSAGE = 60000;

const createRelease = async (
octokit: Octokit,
{ pkg, tagName }: { pkg: Package; tagName: string },
{ pkg, tagName, draft }: { pkg: Package; tagName: string; draft: boolean },
) => {
let changelog;
try {
Expand All @@ -59,6 +59,7 @@ const createRelease = async (
tag_name: tagName,
body: changelogEntry.content,
prerelease: pkg.packageJson.version.includes("-"),
draft,
...context.repo,
});
};
Expand All @@ -67,6 +68,7 @@ type PublishOptions = {
script?: string;
fromPackDir?: string;
createGithubReleases: boolean;
githubReleasesDraft: boolean;
pushGitTags: boolean;
github: GitHub;
cwd: string;
Expand Down Expand Up @@ -160,6 +162,7 @@ export async function runPublish({
fromPackDir,
github,
createGithubReleases,
githubReleasesDraft,
pushGitTags,
cwd,
}: PublishOptions): Promise<PublishResult> {
Expand Down Expand Up @@ -239,7 +242,11 @@ export async function runPublish({
await github.pushTag(tag);
}
if (createGithubReleases) {
await createRelease(octokit, { pkg, tagName: tag });
await createRelease(octokit, {
pkg,
tagName: tag,
draft: githubReleasesDraft,
});
}
}),
);
Expand Down