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/good-mice-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/action": minor
---

Allow a custom PR branch name with prBranchSuffix
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This action for [Changesets](https://github.com/changesets/changesets) creates a
- createGithubReleases - A boolean value to indicate whether to create Github releases after `publish` or not. Default to `true`
- commitMode - Specifies the commit mode. Use `"git-cli"` to push changes using the Git CLI, or `"github-api"` to push changes via the GitHub API. When using `"github-api"`, all commits and tags are GPG-signed and attributed to the user or app who owns the `GITHUB_TOKEN`. Default to `git-cli`.
- cwd - Changes node's `process.cwd()` if the project is not located on the root. Default to `process.cwd()`
- branch - Sets the branch in which the action will run. Default to `github.ref_name`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs on this input were missing so I've added them along with the new input

- prBranchSuffix - The suffix to include after `changeset-release/` in the PR branch. Defaults to the `branch` variable.

### Outputs

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ inputs:
or app who owns the GITHUB_TOKEN.
required: false
default: "git-cli"
prBranchSuffix:
description: The suffix to include after `changeset-release/` in the PR branch. Defaults to the `branch` variable.
required: false
branch:
description: Sets the branch in which the action will run. Default to `github.ref_name` if not provided
required: false
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
commitMessage: getOptionalInput("commit"),
hasPublishScript,
branch: getOptionalInput("branch"),
prBranchSuffix: getOptionalInput("prBranchSuffix"),
});

core.setOutput("pullRequestNumber", String(pullRequestNumber));
Expand Down
4 changes: 3 additions & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ type VersionOptions = {
hasPublishScript?: boolean;
prBodyMaxCharacters?: number;
branch?: string;
prBranchSuffix?: string;
};

type RunVersionResult = {
Expand All @@ -273,8 +274,9 @@ export async function runVersion({
hasPublishScript = false,
prBodyMaxCharacters = MAX_CHARACTERS_PER_MESSAGE,
branch = github.context.ref.replace("refs/heads/", ""),
prBranchSuffix,
}: VersionOptions): Promise<RunVersionResult> {
let versionBranch = `changeset-release/${branch}`;
let versionBranch = `changeset-release/${prBranchSuffix ?? branch}`;

let { preState } = await readChangesetState(cwd);

Expand Down