From 00a64ffe54521c80365123214a2d41bd443fa40f Mon Sep 17 00:00:00 2001 From: Syafa Adena Date: Wed, 12 Jun 2024 23:44:59 +0700 Subject: [PATCH] Update bug.yml --- .github/workflows/bug.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bug.yml b/.github/workflows/bug.yml index 6bafbce..d602be1 100644 --- a/.github/workflows/bug.yml +++ b/.github/workflows/bug.yml @@ -56,8 +56,16 @@ jobs: cat hosts-hasilsorted | sudo tee -a hosts > /dev/null - name: Remove Adjacent Empty Lines run: | - awk '/(\.+$)/' hosts > hosts.tmp - mv hosts.tmp hosts + remove_adjacent_empty_lines() { + local file_path="$1" + local temp_file=$(mktemp) + + awk 'NF || !p {print} {p = !NF}' "$file_path" > "$temp_file" + mv "$temp_file" "$file_path" + } + + file_path='hosts' + remove_adjacent_empty_lines "$file_path" - name: Commit changes run: | git config --global user.email "gvoze32@yahoo.com"