Skip to content

Commit d544625

Browse files
cregourdryanwilsonperkin
authored andcommitted
Allow customize branch name
1 parent 04d574e commit d544625

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

.changeset/good-mice-brake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/action": patch
3+
---
4+
5+
Allow customize branch name

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ inputs:
3636
or app who owns the GITHUB_TOKEN.
3737
required: false
3838
default: "git-cli"
39+
branchName:
40+
description: Sets the branch name for the pull request. Default to `changeset-release/{{$github.ref_name}}`
41+
required: false
3942
branch:
4043
description: Sets the branch in which the action will run. Default to `github.ref_name` if not provided
4144
required: false

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
126126
commitMessage: getOptionalInput("commit"),
127127
hasPublishScript,
128128
branch: getOptionalInput("branch"),
129+
branchName: getOptionalInput("branchName"),
129130
});
130131

131132
core.setOutput("pullRequestNumber", String(pullRequestNumber));

src/run.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import {
2020

2121
const require = createRequire(import.meta.url);
2222

23-
// GitHub Issues/PRs messages have a max size limit on the
23+
// GitHub Issues/PRs messages have a max size limit on th
24+
25+
2426
// message body payload.
2527
// `body is too long (maximum is 65536 characters)`.
2628
// To avoid that, we ensure to cap the message to 60k chars.
@@ -257,6 +259,7 @@ type VersionOptions = {
257259
hasPublishScript?: boolean;
258260
prBodyMaxCharacters?: number;
259261
branch?: string;
262+
branchName?: string;
260263
};
261264

262265
type RunVersionResult = {
@@ -273,8 +276,9 @@ export async function runVersion({
273276
hasPublishScript = false,
274277
prBodyMaxCharacters = MAX_CHARACTERS_PER_MESSAGE,
275278
branch = github.context.ref.replace("refs/heads/", ""),
279+
branchName
276280
}: VersionOptions): Promise<RunVersionResult> {
277-
let versionBranch = `changeset-release/${branch}`;
281+
let versionBranch = branchName ?? `changeset-release/${branch}`;
278282

279283
let { preState } = await readChangesetState(cwd);
280284

0 commit comments

Comments
 (0)