Skip to content

Commit 954c871

Browse files
committed
Update: block emails only when true
1 parent a2720f4 commit 954c871

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

main.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,23 @@ function block_emails() {
270270

271271
hosts_block_email=$(shyaml get-value "$GITHUB_BRANCH.block_emails" < "$hosts_file" 2>/dev/null || exit 0)
272272

273+
# priority: hosts.yml > workflow
273274
if [[ -n "$hosts_block_email" ]]; then
274-
BLOCK_EMAILS="$hosts_block_email"
275+
276+
match_hosts_block_email=$(echo "$hosts_block_email" | awk '{$1=$1;print tolower($0)}')
277+
278+
if [[ "${match_hosts_block_email}" == 'true' ]]; then
279+
BLOCK_EMAILS="$hosts_block_email"
280+
else
281+
BLOCK_EMAILS=''
282+
fi
275283
fi
276284

277285
if [[ -n "$BLOCK_EMAILS" ]]; then
286+
MATCH_BLOCK_EMAIL=$(echo "$BLOCK_EMAILS" | awk '{$1=$1;print tolower($0)}')
287+
fi
288+
289+
if [[ "$MATCH_BLOCK_EMAIL" == 'true' ]]; then
278290

279291
# priority: 1. hosts.yml 2. vip 3. WP
280292
echo -e "\033[34mSETUP EMAIL BLOCKING\033[0m"

0 commit comments

Comments
 (0)