Skip to content

Commit

Permalink
Fix language mistakes
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Li <[email protected]>
  • Loading branch information
consideRatio and manics committed Feb 20, 2024
1 parent 853134c commit 6f40325
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ inputs:
prefix:
required: false
description: |-
One or more whitespace or comma deliminated prefixes for returned tags.
One or more whitespace or comma delimited prefixes for returned tags.
As an example, prefix could be set to `ghcr.io/a/b: quay.io/a/b:` to
provide image names with tags for two separate repositories.
The string `""` can be used to represent an empty string, and
all permutations of prefixes and suffixes are considered.
all combinations of prefixes and suffixes are used.
default: ""
suffix:
required: false
description: |-
One or more whitespace or comma deliminated suffixes for returned tags.
One or more whitespace or comma delimited suffixes for returned tags.
As an example, suffix could be set to `"" -debian` to provide
a default image variant without suffix next to an image variant referred
to with a -debian suffix.
The string `""` can be used to represent an empty string, and
all permutations of prefixes and suffixes are considered.
all combinations of prefixes and suffixes are used.
default: ""
defaultTag:
required: false
Expand Down
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function checkAgainstRegex(name, regexAllowed) {
}

function expandPrefixSuffix(prefix, suffix, tag) {
// Adds all permutations of prefixes and suffixes to a tag, where
// Adds all combinations of prefixes and suffixes to a tag, where
// prefix/suffix could be a single prefix/suffix or a comma/whitespace
// separated list of prefixes/suffixes. If "" is observed, its
// replaced with an empty string.
Expand All @@ -35,14 +35,13 @@ function expandPrefixSuffix(prefix, suffix, tag) {
prefixes = prefixes.map((p) => p.replaceAll(/""/g, ""));
suffixes = suffixes.map((p) => p.replaceAll(/""/g, ""));

// the permutation logic requires at least one element in each list
// the combination logic requires at least one element in each list
if (prefixes.length == 0) {
prefixes.push("");
}
if (suffixes.length == 0) {
suffixes.push("");
}
// permute
return prefixes.flatMap((p) => suffixes.map((s) => `${p}${tag}${s}`));
}

Expand Down

0 comments on commit 6f40325

Please sign in to comment.