mirror of
https://github.com/rlespinasse/slugify-value.git
synced 2026-05-17 10:15:43 +00:00
1d53af49fbebc58b4f7220584de5ca9d7c47e7af
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
-character - limit the string size to 63 characters
- remove trailing
-character
-
<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., and_characters 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 length limit
- uses: rlespinasse/slugify-value@v1.x with: key: EXISTING_ENV_VAR slug-maxlength: "nolimit"Will produce SLUG variables without limiting the output length
-
Slugify a value without publishing the environment variables
- uses: rlespinasse/slugify-value@v1.x with: key: KEY_NAME value: value_to_slugifyWill not make available
KEY_NAMEKEY_NAME_SLUGKEY_NAME_SLUG_CSKEY_NAME_SLUG_URLKEY_NAME_SLUG_URL_CS
Inputs
| Input | Description | Mandatory | Default |
|---|---|---|---|
| key | Environment variable that will hold the value and serve as prefix to slugified value | Yes | |
| value | The value to slugify. If not set the value will be taken from the key input as environment variable |
No | |
| prefix | The value will be prepend to each generated variable | No | |
| slug-maxlength | The value is a number or nolimit to reflect the length of the slug outputs |
No | 63 |
| publish-env | In addition of the action output, the slug values are publish as environment variables | No | true |
Outputs
| Output | Description |
|---|---|
| value | The value to be slugify |
| slug | Value Slug |
| slug-cs | Value Slug (Case-sensitive) |
| slug-url | Value Slug URL |
| slug-url-cs | Value Slug URL (Case-sensitive) |
Description
Languages
Shell
100%