mirror of
https://github.com/rlespinasse/github-slug-action.git
synced 2026-06-14 10:31:21 +00:00
fix: remove leading and trailing - caracter
This commit is contained in:
committed by
Romain Lespinasse
parent
93d0a6d6be
commit
be6ec48344
@@ -6,7 +6,8 @@ This action slug and expose some github variables.
|
|||||||
|
|
||||||
- put the variable content in lower case,
|
- put the variable content in lower case,
|
||||||
- replace any caracter by `-` except `0-9` and `a-z`,
|
- replace any caracter by `-` except `0-9` and `a-z`,
|
||||||
- limit the string size to 63 caracters
|
- remove leading and trailing `-` caracter,
|
||||||
|
- limit the string size to 63 caracters.
|
||||||
|
|
||||||
## Environement Variables
|
## Environement Variables
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
slug_ref() {
|
slug_ref() {
|
||||||
echo "$1" \
|
echo "$1" \
|
||||||
| tr "[:upper:]" "[:lower:]" \
|
| tr "[:upper:]" "[:lower:]" \
|
||||||
|
| sed -r 's#refs/.*/##;s/[~\^]+//g;s/[^a-zA-Z0-9]+/-/g;s/^-+\|-+$//g;s/^-*//;s/-*$//' \
|
||||||
| cut -c1-63
|
| cut -c1-63
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user