From 9b430507700497c2e6ae35e93988e9232f6eb552 Mon Sep 17 00:00:00 2001 From: Nico Korthout Date: Mon, 29 May 2023 20:03:26 +0200 Subject: [PATCH] fix: space-delimit target_branches input 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. --- README.md | 2 +- action.yml | 2 +- src/backport.ts | 2 +- src/test/backport.test.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b298002..f1dacee 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/action.yml b/action.yml index 3f4ec05..6631fea 100644 --- a/action.yml +++ b/action.yml @@ -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: diff --git a/src/backport.ts b/src/backport.ts index 79f98c9..9e662eb 100644 --- a/src/backport.ts +++ b/src/backport.ts @@ -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 !== "") ?? []; diff --git a/src/test/backport.test.ts b/src/test/backport.test.ts index 93a6bd8..b7e4366 100644 --- a/src/test/backport.test.ts +++ b/src/test/backport.test.ts @@ -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", }, [] )