mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Feature: Allow custom branch (#255)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@changesets/action": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Allow customize PR `branch` field
|
||||||
@@ -28,6 +28,9 @@ inputs:
|
|||||||
description: "A boolean value to indicate whether to create Github releases after `publish` or not"
|
description: "A boolean value to indicate whether to create Github releases after `publish` or not"
|
||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
|
branch:
|
||||||
|
description: Sets the branch in which the action will run. Default to `github.ref_name` if not provided
|
||||||
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
published:
|
published:
|
||||||
description: A boolean value to indicate whether a publishing is happened or not
|
description: A boolean value to indicate whether a publishing is happened or not
|
||||||
|
|||||||
@@ -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,
|
||||||
|
branch: getOptionalInput("branch"),
|
||||||
});
|
});
|
||||||
|
|
||||||
core.setOutput("pullRequestNumber", String(pullRequestNumber));
|
core.setOutput("pullRequestNumber", String(pullRequestNumber));
|
||||||
|
|||||||
+3
-1
@@ -299,6 +299,7 @@ type VersionOptions = {
|
|||||||
commitMessage?: string;
|
commitMessage?: string;
|
||||||
hasPublishScript?: boolean;
|
hasPublishScript?: boolean;
|
||||||
prBodyMaxCharacters?: number;
|
prBodyMaxCharacters?: number;
|
||||||
|
branch?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type RunVersionResult = {
|
type RunVersionResult = {
|
||||||
@@ -313,11 +314,12 @@ export async function runVersion({
|
|||||||
commitMessage = "Version Packages",
|
commitMessage = "Version Packages",
|
||||||
hasPublishScript = false,
|
hasPublishScript = false,
|
||||||
prBodyMaxCharacters = MAX_CHARACTERS_PER_MESSAGE,
|
prBodyMaxCharacters = MAX_CHARACTERS_PER_MESSAGE,
|
||||||
|
branch,
|
||||||
}: VersionOptions): Promise<RunVersionResult> {
|
}: VersionOptions): Promise<RunVersionResult> {
|
||||||
const octokit = setupOctokit(githubToken);
|
const octokit = setupOctokit(githubToken);
|
||||||
|
|
||||||
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/", "");
|
branch = branch ?? github.context.ref.replace("refs/heads/", "");
|
||||||
let versionBranch = `changeset-release/${branch}`;
|
let versionBranch = `changeset-release/${branch}`;
|
||||||
|
|
||||||
let { preState } = await readChangesetState(cwd);
|
let { preState } = await readChangesetState(cwd);
|
||||||
|
|||||||
Reference in New Issue
Block a user