diff --git a/.changeset/good-mice-brake.md b/.changeset/good-mice-brake.md new file mode 100644 index 00000000..5f7b1b61 --- /dev/null +++ b/.changeset/good-mice-brake.md @@ -0,0 +1,5 @@ +--- +"@changesets/action": minor +--- + +Allow a custom PR branch name with prBranchSuffix diff --git a/README.md b/README.md index 5ea2e5e5..33c0f934 100644 --- a/README.md +++ b/README.md @@ -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` +- prBranchSuffix - The suffix to include after `changeset-release/` in the PR branch. Defaults to the `branch` variable. ### Outputs diff --git a/action.yml b/action.yml index 5b74beca..c401a379 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/src/index.ts b/src/index.ts index 1b0f63ab..688c1077 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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)); diff --git a/src/run.ts b/src/run.ts index 18ec1da4..f8fb27dd 100644 --- a/src/run.ts +++ b/src/run.ts @@ -257,6 +257,7 @@ type VersionOptions = { hasPublishScript?: boolean; prBodyMaxCharacters?: number; branch?: string; + prBranchSuffix?: string; }; type RunVersionResult = { @@ -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 { - let versionBranch = `changeset-release/${branch}`; + let versionBranch = `changeset-release/${prBranchSuffix ?? branch}`; let { preState } = await readChangesetState(cwd);