mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-22 21:16:38 +00:00
Add the string-case
action
This commit is contained in:
parent
83932645af
commit
2a0c59380a
53
.github/actions/string-case/action.yml
vendored
Normal file
53
.github/actions/string-case/action.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
name: Change String Case
|
||||
description: Make a string lowercase, uppercase, or capitalized
|
||||
|
||||
inputs:
|
||||
string:
|
||||
description: The input string
|
||||
required: true
|
||||
|
||||
outputs:
|
||||
lowercase:
|
||||
value: ${{ steps.set.outputs.lowercase }}
|
||||
description: The input string, with any uppercase characters replaced with lowercase ones
|
||||
uppercase:
|
||||
value: ${{ steps.set.outputs.uppercase }}
|
||||
description: The input string, with any lowercase characters replaced with uppercase ones
|
||||
capitalized:
|
||||
value: ${{ steps.set.outputs.capitalized }}
|
||||
description: The input string, with any alphabetical characters lowercase, except for the first character, which is uppercased
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Retrieve releases
|
||||
id: 'set'
|
||||
env:
|
||||
INPUT_STRING: '${{ inputs.string }}'
|
||||
shell: 'bash'
|
||||
run: |
|
||||
set_sl_var() { local f='%s=%s\n' ; printf -- "${f}" "$@" ; } ;
|
||||
mk_delim() { printf -- '"%s_EOF_%d_"' "$1" "${RANDOM}" ; } ;
|
||||
open_ml_var() { local f=''\%'s<<'\%'s\n' ; printf -- "${f}" "$2" "$1" ; } ;
|
||||
close_ml_var() { local f='%s\n' ; printf -- "${f}" "$1" ; } ;
|
||||
{
|
||||
|
||||
var='lowercase' ;
|
||||
delim="$(mk_delim "${var}")" ;
|
||||
open_ml_var "${delim}" "${var}" ;
|
||||
printf -- '%s\n' "${INPUT_STRING,,}" ;
|
||||
close_ml_var "${delim}" "${var}" ;
|
||||
|
||||
var='capitalized' ;
|
||||
delim="$(mk_delim "${var}")" ;
|
||||
open_ml_var "${delim}" "${var}" ;
|
||||
printf -- '%s\n' "${INPUT_STRING^}" ;
|
||||
close_ml_var "${delim}" "${var}" ;
|
||||
|
||||
var='uppercase' ;
|
||||
delim="$(mk_delim "${var}")" ;
|
||||
open_ml_var "${delim}" "${var}" ;
|
||||
printf -- '%s\n' "${INPUT_STRING^^}" ;
|
||||
close_ml_var "${delim}" "${var}" ;
|
||||
|
||||
} >> "${GITHUB_OUTPUT}"
|
Loading…
Reference in New Issue
Block a user