Slugify
Github Action to slugify a value
Produce some slug-ed environment variables based on the input one.
-
<env name>_SLUG- put the variable content in lower case
- replace any character by
-except0-9,a-z,., and_ - remove leading and trailing
-character - limit the string size to 63 characters
-
<env name>_SLUG_CS- like
<env name>_SLUGbut the content is not put in lower case
- like
-
<env name>_SLUG_URL(or<env name>_SLUG_URL_CS)- like
<env name>_SLUG(or<env name>_SLUG_CS) with the.character also replaced by-
- like
Usage
-
Slugify a value and store it using a key
- uses: rlespinasse/slugify-value@v1.x with: key: KEY_NAME value: value_to_slugifyWill make available
KEY_NAMEKEY_NAME_SLUGKEY_NAME_SLUG_CSKEY_NAME_SLUG_URLKEY_NAME_SLUG_URL_CS
-
Slugify the value of an environment variable
- uses: rlespinasse/slugify-value@v1.x with: key: EXISTING_ENV_VARWill make available
EXISTING_ENV_VAR_SLUGEXISTING_ENV_VAR_SLUG_CSEXISTING_ENV_VAR_SLUG_URLEXISTING_ENV_VAR_SLUG_URL_CS
-
Slugify the value of an environment variable with prefix
- uses: rlespinasse/slugify-value@v1.x with: key: EXISTING_ENV_VAR prefix: CI_Will make available
CI_EXISTING_ENV_VARCI_EXISTING_ENV_VAR_SLUGCI_EXISTING_ENV_VAR_SLUG_CSCI_EXISTING_ENV_VAR_SLUG_URLCI_EXISTING_ENV_VAR_SLUG_URL_CS
-
Slugify a value with a different slug length
- uses: rlespinasse/slugify-value@v1.x with: key: EXISTING_ENV_VAR slug-maxlength: 80Will produce SLUG variables with a 80-char length
-
Slugify a value without
- uses: rlespinasse/slugify-value@v1.x with: key: EXISTING_ENV_VAR slug-maxlength: "nolimit"Will produce SLUG variables without limiting the output length
Inputs
key
Environment variable that will hold the value and serve as prefix to slugified value.
This input is Mandatory.
value
The value to slugify. If not set the value will be taken from the key input as environment variable.
This input is Optional.
prefix
The value will be prepend to each generated variable.
This input is Optional.
slug-maxlength
The value is a number or nolimit to reflect the length of the slug outputs
This input is Optional. The default value is 63.