mirror of
https://github.com/rlespinasse/slugify-value.git
synced 2026-09-19 05:35:49 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9694a6bf2 |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -1 +0,0 @@
|
|||||||
* @rlespinasse
|
|
||||||
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,23 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ''
|
|
||||||
labels: bug
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
**To Reproduce**
|
|
||||||
Steps to reproduce the behavior
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
**Screenshots**
|
|
||||||
If applicable, add screenshots to help explain your problem.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: ''
|
|
||||||
labels: enhancement
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
||||||
19
.github/dependabot.yml
vendored
19
.github/dependabot.yml
vendored
@@ -1,18 +1,7 @@
|
|||||||
|
---
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: 'github-actions'
|
- package-ecosystem: "github-actions"
|
||||||
directory: '/'
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: 'weekly'
|
interval: "weekly"
|
||||||
cooldown:
|
|
||||||
default-days: 5
|
|
||||||
commit-message:
|
|
||||||
prefix: 'build'
|
|
||||||
include: 'scope'
|
|
||||||
groups:
|
|
||||||
dependencies:
|
|
||||||
patterns:
|
|
||||||
- '*'
|
|
||||||
update-types:
|
|
||||||
- 'minor'
|
|
||||||
- 'patch'
|
|
||||||
|
|||||||
25
.github/workflows/dependabot-auto-merge.yml
vendored
25
.github/workflows/dependabot-auto-merge.yml
vendored
@@ -1,25 +0,0 @@
|
|||||||
name: Dependabot auto-merge
|
|
||||||
|
|
||||||
on: pull_request
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
auto-merge:
|
|
||||||
if: github.event.pull_request.user.login == 'dependabot[bot]'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Dependabot metadata
|
|
||||||
id: metadata
|
|
||||||
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Enable auto-merge for minor/patch updates
|
|
||||||
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
|
|
||||||
run: gh pr merge --auto --squash "$PR_URL"
|
|
||||||
env:
|
|
||||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
13
.github/workflows/linter.yml
vendored
13
.github/workflows/linter.yml
vendored
@@ -3,8 +3,6 @@ name: Lint Code Base
|
|||||||
|
|
||||||
on: pull_request
|
on: pull_request
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Lint Code Base
|
name: Lint Code Base
|
||||||
@@ -15,16 +13,15 @@ jobs:
|
|||||||
statuses: write
|
statuses: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
# Full git history is needed to get a proper
|
# Full git history is needed to get a proper list of changed files within `super-linter`
|
||||||
# list of changed files within `super-linter`
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Lint Code Base
|
- name: Lint Code Base
|
||||||
uses: super-linter/super-linter@v8
|
uses: github/super-linter@v5
|
||||||
env:
|
env:
|
||||||
VALIDATE_ALL_CODEBASE: false
|
VALIDATE_ALL_CODEBASE: false
|
||||||
VALIDATE_GITHUB_ACTIONS_ZIZMOR: false
|
DEFAULT_BRANCH: v1.x
|
||||||
VALIDATE_YAML_PRETTIER: false
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
23
.github/workflows/slugify-value.yaml
vendored
23
.github/workflows/slugify-value.yaml
vendored
@@ -1,15 +1,9 @@
|
|||||||
---
|
|
||||||
name: Slugify Value
|
name: Slugify Value
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- v1.x
|
- v1.x
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
# Disable line length check due to the content of the tests
|
|
||||||
# yamllint disable rule:line-length
|
|
||||||
jobs:
|
jobs:
|
||||||
os-testing:
|
os-testing:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -19,7 +13,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Test 1
|
# Test 1
|
||||||
- name: Slugify key only
|
- name: Slugify key only
|
||||||
@@ -30,11 +24,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
KEY_ONLY: "refs/head/$-Key_Only.test--value-%-+"
|
KEY_ONLY: "refs/head/$-Key_Only.test--value-%-+"
|
||||||
- name: Validate // Slugify key only
|
- name: Validate // Slugify key only
|
||||||
# Disable SC2193 because the first line of the test is flag by shellcheck
|
|
||||||
# as the comparison can never be equal but the test pass.
|
|
||||||
# Seem a false-positive due to the test context.
|
|
||||||
run: |
|
run: |
|
||||||
# shellcheck disable=SC2193
|
|
||||||
[[ "${{ env.KEY_ONLY }}" == "refs/head/$-Key_Only.test--value-%-+" ]]
|
[[ "${{ env.KEY_ONLY }}" == "refs/head/$-Key_Only.test--value-%-+" ]]
|
||||||
[[ "${{ env.KEY_ONLY_SLUG }}" == "key_only.test--value" ]]
|
[[ "${{ env.KEY_ONLY_SLUG }}" == "key_only.test--value" ]]
|
||||||
[[ "${{ env.KEY_ONLY_SLUG_CS }}" == "Key_Only.test--value" ]]
|
[[ "${{ env.KEY_ONLY_SLUG_CS }}" == "Key_Only.test--value" ]]
|
||||||
@@ -176,23 +166,14 @@ jobs:
|
|||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
issues: write
|
|
||||||
id-token: write
|
|
||||||
packages: write
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: release-${{ github.ref }}
|
group: release-${{ github.ref }}
|
||||||
needs:
|
needs:
|
||||||
- os-testing
|
- os-testing
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
# Release
|
# Release
|
||||||
- name: Release this GitHub Action
|
- name: Release this GitHub Action
|
||||||
uses: rlespinasse/release-that@v1
|
uses: rlespinasse/release-that@v1
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GH_TOKEN }}
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ We as members, contributors, and leaders pledge to make participation in our
|
|||||||
community a harassment-free experience for everyone, regardless of age, body
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
identity and expression, level of experience, education, socio-economic status,
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
identity and orientation.
|
and orientation.
|
||||||
|
|
||||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
diverse, inclusive, and healthy community.
|
diverse, inclusive, and healthy community.
|
||||||
@@ -22,17 +22,17 @@ community include:
|
|||||||
* Giving and gracefully accepting constructive feedback
|
* Giving and gracefully accepting constructive feedback
|
||||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
and learning from the experience
|
and learning from the experience
|
||||||
* Focusing on what is best not just for us as individuals, but for the overall
|
* Focusing on what is best not just for us as individuals, but for the
|
||||||
community
|
overall community
|
||||||
|
|
||||||
Examples of unacceptable behavior include:
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
* The use of sexualized language or imagery, and sexual attention or
|
||||||
any kind
|
advances of any kind
|
||||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
* Public or private harassment
|
* Public or private harassment
|
||||||
* Publishing others' private information, such as a physical or email address,
|
* Publishing others' private information, such as a physical or email
|
||||||
without their explicit permission
|
address, without their explicit permission
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
professional setting
|
professional setting
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ decisions when appropriate.
|
|||||||
|
|
||||||
This Code of Conduct applies within all community spaces, and also applies when
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
an individual is officially representing the community in public spaces.
|
an individual is officially representing the community in public spaces.
|
||||||
Examples of representing our community include using an official email address,
|
Examples of representing our community include using an official e-mail address,
|
||||||
posting via an official social media account, or acting as an appointed
|
posting via an official social media account, or acting as an appointed
|
||||||
representative at an online or offline event.
|
representative at an online or offline event.
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ representative at an online or offline event.
|
|||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported to the community leaders responsible for enforcement at
|
reported to the community leaders responsible for enforcement at
|
||||||
<romain.lespinasse@gmail.com>.
|
romain.lespinasse@gmail.com.
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
@@ -82,15 +82,15 @@ behavior was inappropriate. A public apology may be requested.
|
|||||||
|
|
||||||
### 2. Warning
|
### 2. Warning
|
||||||
|
|
||||||
**Community Impact**: A violation through a single incident or series of
|
**Community Impact**: A violation through a single incident or series
|
||||||
actions.
|
of actions.
|
||||||
|
|
||||||
**Consequence**: A warning with consequences for continued behavior. No
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
interaction with the people involved, including unsolicited interaction with
|
interaction with the people involved, including unsolicited interaction with
|
||||||
those enforcing the Code of Conduct, for a specified period of time. This
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
includes avoiding interactions in community spaces as well as external channels
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
like social media. Violating these terms may lead to a temporary or permanent
|
like social media. Violating these terms may lead to a temporary or
|
||||||
ban.
|
permanent ban.
|
||||||
|
|
||||||
### 3. Temporary Ban
|
### 3. Temporary Ban
|
||||||
|
|
||||||
@@ -109,24 +109,20 @@ Violating these terms may lead to a permanent ban.
|
|||||||
standards, including sustained inappropriate behavior, harassment of an
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
individual, or aggression toward or disparagement of classes of individuals.
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
community.
|
the community.
|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
version 2.1, available at
|
version 2.0, available at
|
||||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||||
|
|
||||||
Community Impact Guidelines were inspired by
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see the FAQ at
|
|
||||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
||||||
[https://www.contributor-covenant.org/translations][translations].
|
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
[homepage]: https://www.contributor-covenant.org
|
||||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
||||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
[FAQ]: https://www.contributor-covenant.org/faq
|
https://www.contributor-covenant.org/faq. Translations are available at
|
||||||
[translations]: https://www.contributor-covenant.org/translations
|
https://www.contributor-covenant.org/translations.
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
# How to contribute to Slugify Value
|
|
||||||
|
|
||||||
## Did you find a bug
|
|
||||||
|
|
||||||
* **Do not open up a GitHub issue if the bug is a security vulnerability**, and instead to refer to our [security policy][1].
|
|
||||||
|
|
||||||
* **Ensure the bug was not already reported** by searching on GitHub under [Issues][2].
|
|
||||||
|
|
||||||
* If you're unable to find an open issue addressing the problem, [open a 'Bug' issue][4].
|
|
||||||
Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
|
|
||||||
|
|
||||||
## Did you write a patch that fixes a bug
|
|
||||||
|
|
||||||
* Open a new GitHub pull request with the patch.
|
|
||||||
|
|
||||||
* Ensure the PR description clearly describes the problem and solution.
|
|
||||||
Include the relevant issue number if applicable.
|
|
||||||
|
|
||||||
## Do you intend to add a new feature or change an existing one
|
|
||||||
|
|
||||||
* Suggest your change by [opening a 'Feature request' issue][5]
|
|
||||||
|
|
||||||
## Do you have questions about the source code
|
|
||||||
|
|
||||||
* [open an issue][3] with your question.
|
|
||||||
|
|
||||||
Thanks!
|
|
||||||
|
|
||||||
[1]: https://github.com/rlespinasse/slugify-value/security/policy
|
|
||||||
[2]: https://github.com/rlespinasse/slugify-value/issues
|
|
||||||
[3]: https://github.com/rlespinasse/slugify-value/issues/new
|
|
||||||
[4]: https://github.com/rlespinasse/slugify-value/issues/new?assignees=&labels=bug&template=bug_report.md&title=
|
|
||||||
[5]: https://github.com/rlespinasse/slugify-value/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=
|
|
||||||
32
README.md
32
README.md
@@ -1,25 +1,24 @@
|
|||||||
# Slugify
|
# Slugify
|
||||||
|
|
||||||
> [!NOTE]
|
> Github Action to slugify a value
|
||||||
> A GitHub Action that transforms input strings into URL-friendly slugs
|
|
||||||
|
|
||||||
This action creates standardized slug versions of your input variables, offering multiple formatting options:
|
Produce some `slug`-ed environment variables based on the input one.
|
||||||
|
|
||||||
## Output Formats
|
|
||||||
|
|
||||||
- `<env name>_SLUG`
|
- `<env name>_SLUG`
|
||||||
- Converts text to lowercase
|
|
||||||
- Replaces special characters with **-** (except **0-9**, **a-z**, **.**, and **_**)
|
|
||||||
- Removes leading and trailing **-$*
|
|
||||||
- Limits string length to **63** characters
|
|
||||||
- `<env name>_SLUG_CS`
|
|
||||||
- Same as `_SLUG` but preserves original case sensitivity
|
|
||||||
- `<env name>_SLUG_URL` and `<env name>_SLUG_URL_CS`
|
|
||||||
- Same as their respective base versions (`_SLUG` or `_SLUG_CS`)
|
|
||||||
- Additionally replaces **.** and **_** with **-**
|
|
||||||
- Perfect for URL-safe strings
|
|
||||||
|
|
||||||
Each output variable maintains consistent formatting rules while serving different use cases, from basic slugification to URL-ready strings.
|
- put the variable content in lower case
|
||||||
|
- replace any character by `-` except `0-9`, `a-z`, `.`, and `_`
|
||||||
|
- remove leading `-` character
|
||||||
|
- limit the string size to 63 characters
|
||||||
|
- remove trailing `-` character
|
||||||
|
|
||||||
|
- `<env name>_SLUG_CS`
|
||||||
|
|
||||||
|
- like `<env name>_SLUG` but the content is not put in lower case
|
||||||
|
|
||||||
|
- `<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 `-`
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -101,7 +100,6 @@ Each output variable maintains consistent formatting rules while serving differe
|
|||||||
with:
|
with:
|
||||||
key: KEY_NAME
|
key: KEY_NAME
|
||||||
value: value_to_slugify
|
value: value_to_slugify
|
||||||
publish-env: false
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Will **not** make available
|
Will **not** make available
|
||||||
|
|||||||
22
SECURITY.md
22
SECURITY.md
@@ -1,22 +0,0 @@
|
|||||||
# Security Policy
|
|
||||||
|
|
||||||
## Supported Versions and Branches
|
|
||||||
|
|
||||||
| Version | Supported | End of Support | Branch | Specific Tags |
|
|
||||||
| ------- | ------------------ | -------------- | ------ | ------------- |
|
|
||||||
| 1.x | :white_check_mark: | | v1.x | v1 |
|
|
||||||
|
|
||||||
A GitHub repository can use one of the available branches as an action inside its workflows.
|
|
||||||
|
|
||||||
### End of Life of a branch
|
|
||||||
|
|
||||||
Since `2024-10-26`, when a new major version is released,
|
|
||||||
|
|
||||||
- The previous one will continue to receive security patches for 3 months,
|
|
||||||
- After the 3 months, the branch is deleted, and only the tags remain.
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
|
||||||
|
|
||||||
In this project, you can report a Vulnerability by creating a [draft security advisory](https://github.com/rlespinasse/slugify-value/security/advisories).
|
|
||||||
|
|
||||||
If the vulnerability is confirmed, a fix will be produced and the advisory will be published.
|
|
||||||
Reference in New Issue
Block a user