11#! /usr/bin/env bash
22
33labeler::label () {
4- local -r fail_if_xl=" $5 "
5- local -r message_if_xl=" $6 "
4+ local -r xs_label=" ${1} "
5+ local -r s_label=" ${3} "
6+ local -r m_label=" ${5} "
7+ local -r l_label=" ${7} "
8+ local -r xl_label=" ${9} "
9+ local -r fail_if_xl=" ${10} "
10+ local -r message_if_xl=" ${11} "
611
712 local -r pr_number=$( github_actions::get_pr_number)
813 local -r total_modifications=$( github::calculate_total_modifications " $pr_number " )
@@ -13,9 +18,9 @@ labeler::label() {
1318
1419 log::message " Labeling pull request with $label_to_add "
1520
16- github::add_label_to_pr " $pr_number " " $label_to_add "
21+ github::add_label_to_pr " $pr_number " " $label_to_add " " $xs_label " " $s_label " " $m_label " " $l_label " " $xl_label "
1722
18- if [ " $label_to_add " == " size/xl " ]; then
23+ if [ " $label_to_add " == " $xl_label " ]; then
1924 if [ -n " $message_if_xl " ]; then
2025 github::comment " $message_if_xl "
2126 fi
@@ -28,22 +33,27 @@ labeler::label() {
2833}
2934
3035labeler::label_for () {
31- local -r total_modifications=" $1 "
32- local -r xs_max_size=" $2 "
33- local -r s_max_size=" $3 "
34- local -r m_max_size=" $4 "
35- local -r l_max_size=" $5 "
36+ local -r total_modifications=" ${1} "
37+ local -r xs_label=" ${2} "
38+ local -r xs_max_size=" ${3} "
39+ local -r s_label=" ${4} "
40+ local -r s_max_size=" ${5} "
41+ local -r m_label=" ${6} "
42+ local -r m_max_size=" ${7} "
43+ local -r l_label=" ${8} "
44+ local -r l_max_size=" ${9} "
45+ local -r xl_label=" ${10} "
3646
3747 if [ " $total_modifications " -lt " $xs_max_size " ]; then
38- label=" size/xs "
48+ label=" $xs_label "
3949 elif [ " $total_modifications " -lt " $s_max_size " ]; then
40- label=" size/s "
50+ label=" $s_label "
4151 elif [ " $total_modifications " -lt " $m_max_size " ]; then
42- label=" size/m "
52+ label=" $m_label "
4353 elif [ " $total_modifications " -lt " $l_max_size " ]; then
44- label=" size/l "
54+ label=" $l_label "
4555 else
46- label=" size/xl "
56+ label=" $xl_label "
4757 fi
4858
4959 echo " $label "
0 commit comments