Skip to content

Commit

Permalink
use a function
Browse files Browse the repository at this point in the history
  • Loading branch information
osterman committed Jan 18, 2024
1 parent c37a6ac commit dbc9ef2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/repo-banner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ jobs:

- name: Format Repo Metadata
id: meta
env:
LANG: en_US.UTF-8
run: |
export LANG
# Function to wrap emojis in a <span> tag
function wrapEmoji() {
emoji="\U1f300-\U1f5ff\U1f900-\U1f9ff\U1f600-\U1f64f\U1f680-\U1f6ff\U2600-\U26ff\U2700-\U27bf\U1f1e6-\U1f1ff\U1f191-\U1f251\U1f004\U1f0cf\U1f170-\U1f171\U1f17e-\U1f17f\U1f18e\U3030\U2b50\U2b55\U2934-\U2935\U2b05-\U2b07\U2b1b-\U2b1c\U3297\U3299\U303d\U00a9\U00ae\U2122\U23f3\U24c2\U23e9-\U23ef\U25b6\U23f8-\U23fa"
sed -e "s/\([$(printf $emoji)]\)/<span class=\"emoji\">\1<\/span>/g" <<<"$*"
}
# Pull the name from the README
name="${{ steps.readme.outputs.name }}"
Expand Down Expand Up @@ -89,13 +98,10 @@ jobs:
desc="${desc/.*}"
fi
# Emoji characters (UTF8)
emoji="\U1f300-\U1f5ff\U1f900-\U1f9ff\U1f600-\U1f64f\U1f680-\U1f6ff\U2600-\U26ff\U2700-\U27bf\U1f1e6-\U1f1ff\U1f191-\U1f251\U1f004\U1f0cf\U1f170-\U1f171\U1f17e-\U1f17f\U1f18e\U3030\U2b50\U2b55\U2934-\U2935\U2b05-\U2b07\U2b1b-\U2b1c\U3297\U3299\U303d\U00a9\U00ae\U2122\U23f3\U24c2\U23e9-\U23ef\U25b6\U23f8-\U23fa"
echo "name=${name}" >> $GITHUB_OUTPUT
echo "type=${type}" >> $GITHUB_OUTPUT
echo "type=$(wrapEmoji ${type})" >> $GITHUB_OUTPUT
echo "name=$(wrapEmoji ${name})" >> $GITHUB_OUTPUT
echo "desc=$(wrapEmoji ${desc})" >> $GITHUB_OUTPUT
echo "output=${output}" >> $GITHUB_OUTPUT
echo "desc=${desc}" | LANG=en_US.UTF-8 sed -e "s/\([$(printf $emoji)]\)/<span class=\"emoji\">\1<\/span>/g" >> $GITHUB_OUTPUT
cat ${GITHUB_OUTPUT}
Expand Down

0 comments on commit dbc9ef2

Please sign in to comment.