From a0516c2eae245d84513228d4c3983a95e4c3ffed Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 15 Feb 2024 18:50:57 +0100 Subject: [PATCH] Revert breaking change to prefix --- action.yml | 4 +++- src/index.js | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 7d25d05..da597f8 100644 --- a/action.yml +++ b/action.yml @@ -14,7 +14,9 @@ inputs: prefix: required: false description: |- - One or more newline deliminated prefixes for returned tags. + One or more whitespace or comma deliminated prefixes for returned tags. + Use of separators besides new lines is deprecated but for now still + supported. All permutations of prefixes and suffixes are considered. default: "" diff --git a/src/index.js b/src/index.js index bda6df7..7d1f8a6 100644 --- a/src/index.js +++ b/src/index.js @@ -181,19 +181,27 @@ async function run() { const defaultTag = core.getInput("defaultTag"); const branchRegex = core.getInput("branchRegex"); - function check_prefix_suffix(input_name, input_value) { + function check_prefix_suffix(input_name, input_value, just_warn) { // Partial check that prefix and suffix inputs are OK // Check if there is any whitespace characters besides new lines or // commas. const re = new RegExp(/^[^\s,]+$/g); if (re.test(input_value.replace("\n", ""))) { - throw new Error( - `Input ${input_name} invalid, contains either comma or whitespace besides the new line separator`, - ); + if (just_warn) { + core.warning( + "Input 'prefix' will soon require the use of new lines to separate prefixes, trim away your other whitespace and commas.", + ); + } else { + throw new Error( + `Input ${input_name} invalid, contains either comma or whitespace besides the new line separator`, + ); + } } } - check_prefix_suffix("prefix", prefix); - check_prefix_suffix("suffix", suffix); + // prefix and suffix has different whitespace separators, we are deprecating + // prefix's separators besides new lines + check_prefix_suffix("prefix", suffix, true); + check_prefix_suffix("suffix", suffix, false); core.debug(JSON.stringify(github.context)); const allTags = await calculateTags({