Skip to content

Commit

Permalink
Revert breaking change to prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Feb 15, 2024
1 parent 5b0dd69 commit a0516c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
20 changes: 14 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit a0516c2

Please sign in to comment.