Skip to content

Commit 417e60a

Browse files
authored
Add support for emojis in labels (#17)
* Improve readme * Add support for emojis in labels
1 parent 18be839 commit 417e60a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
m_max_size: '500'
4141
l_max_size: '1000'
4242
fail_if_xl: 'false'
43-
message_if_xl: 'This PR is sooooo big! Please, split it 😊'
43+
message_if_xl: 'This PR is so big! Please, split it 😊'
4444
```
4545
4646
> If you want, you can customize all `*_max_size` with the size that fits in your project.

src/github.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ github::add_label_to_pr() {
1818

1919
local -r body=$(curl -sSL -H "Authorization: token $GITHUB_TOKEN" -H "$GITHUB_API_HEADER" "$GITHUB_API_URI/repos/$GITHUB_REPOSITORY/pulls/$1")
2020
local labels=$(echo "$body" | jq .labels | jq -r ".[] | .name" | grep -v "size/")
21-
labels+=("$label_to_add")
22-
23-
local -r comma_separated_labels=$(github::format_labels "${labels[@]/#/}")
21+
labels=$(printf "%s\n%s" "$labels" "$label_to_add")
22+
local -r comma_separated_labels=$(github::format_labels "$labels")
2423

2524
log::message "Final labels: $comma_separated_labels"
2625

@@ -34,11 +33,16 @@ github::add_label_to_pr() {
3433
}
3534

3635
github::format_labels() {
36+
SAVEIFS=$IFS
37+
IFS=$'\n'
38+
local -r labels=($@)
39+
IFS=$SAVEIFS
3740
quoted_labels=()
38-
for label in "${@}"; do
39-
if [ -n "$label" ]; then
40-
quoted_labels+=("$(str::quote "$label")")
41-
fi
41+
42+
for ((i = 0; i < ${#labels[@]}; i++)); do
43+
# echo "Label $i: ${labels[$i]}"
44+
label="${labels[$i]}"
45+
quoted_labels+=("$(str::quote "$label")")
4246
done
4347

4448
coll::join_by "," "${quoted_labels[@]/#/}"

0 commit comments

Comments
 (0)