Skip to content

Commit

Permalink
fix: space-delimit target_branches input
Browse files Browse the repository at this point in the history
Originally, I went for comma-separated values in the target_branches
input. However, commas are a valid char in git branchnames.

I think it makes more sense to delimit the values on spaces. Spaces are
not allowed in branchnames.
  • Loading branch information
korthout committed May 29, 2023
1 parent feee055 commit 9b43050
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Please refer to this action's README for all available [placeholders](#placehold

Default: `''` (disabled)

The action will backport the pull request to each specified target branch (comma-separated).
The action will backport the pull request to each specified target branch (space-delimited).
See [How it works](#how-it-works).

Can be used in addition to backport labels.
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ inputs:
[Backport ${target_branch}] ${pull_title}
target_branches:
description: >
The action will backport the pull request to each specified target branch (comma-separated).
The action will backport the pull request to each specified target branch (space-delimited).
Can be used in addition to backport labels.
By default, only backport labels are used to specify the target branches.
outputs:
Expand Down
2 changes: 1 addition & 1 deletion src/backport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export function findTargetBranches(
const targetBranchesFromLabels = findTargetBranchesFromLabels(labels, config);
const configuredTargetBranches =
config.target_branches
?.split(",")
?.split(" ")
.map((t) => t.trim())
.filter((t) => t !== "") ?? [];

Expand Down
2 changes: 1 addition & 1 deletion src/test/backport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe("find target branches", () => {
findTargetBranches(
{
labels: { pattern: default_pattern },
target_branches: "release-1,another/target/branch",
target_branches: "release-1 another/target/branch",
},
[]
)
Expand Down

0 comments on commit 9b43050

Please sign in to comment.