File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,19 @@ github::calculate_total_modifications() {
52
52
echo $(( additions + deletions))
53
53
}
54
54
55
+ github::has_label () {
56
+ local -r pr_number=" ${1} "
57
+ local -r label_to_check=" ${2} "
58
+
59
+ local -r body=$( curl -sSL -H " Authorization: token $GITHUB_TOKEN " -H " $GITHUB_API_HEADER " " $GITHUB_API_URL /repos/$GITHUB_REPOSITORY /issues/$pr_number /labels" )
60
+ for label in $( echo " $body " | jq -r ' .[] | @base64' ) ; do
61
+ if [ " $( echo ${label} | base64 -d | jq -r ' .name' ) " = " $label_to_check " ]; then
62
+ return 0
63
+ fi
64
+ done
65
+ return 1
66
+ }
67
+
55
68
github::add_label_to_pr () {
56
69
local -r pr_number=" ${1} "
57
70
local -r label_to_add=" ${2} "
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ labeler::label() {
25
25
github::add_label_to_pr " $pr_number " " $label_to_add " " $xs_label " " $s_label " " $m_label " " $l_label " " $xl_label "
26
26
27
27
if [ " $label_to_add " == " $xl_label " ]; then
28
- if [ -n " $message_if_xl " ]; then
28
+ if [ -n " $message_if_xl " ] && ! github::has_label " $pr_number " " $label_to_add " ; then
29
29
github::comment " $message_if_xl "
30
30
fi
31
31
You can’t perform that action at this time.
0 commit comments