Skip to content

Commit

Permalink
Add check of prefix and suffix input
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Feb 15, 2024
1 parent 27356cd commit 5b0dd69
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,20 @@ async function run() {
const defaultTag = core.getInput("defaultTag");
const branchRegex = core.getInput("branchRegex");

function check_prefix_suffix(input_name, input_value) {
// 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`,
);
}
}
check_prefix_suffix("prefix", prefix);
check_prefix_suffix("suffix", suffix);

core.debug(JSON.stringify(github.context));
const allTags = await calculateTags({
token: githubToken,
Expand Down

0 comments on commit 5b0dd69

Please sign in to comment.