From cd71fce3f9707c9d7ea40fc769f2b4188c98470d Mon Sep 17 00:00:00 2001 From: Slimane MEHARZI <59923212+SlyPex@users.noreply.github.com> Date: Tue, 6 Aug 2024 00:38:19 +0100 Subject: [PATCH] Fixed Scripts of both github & gitlab README file checker --- .github/scripts/readme_file_checker.sh | 5 ++--- .gitlab/scripts/readme_file_checker.sh | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/scripts/readme_file_checker.sh b/.github/scripts/readme_file_checker.sh index e3b935d..7e914de 100755 --- a/.github/scripts/readme_file_checker.sh +++ b/.github/scripts/readme_file_checker.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -euo pipefail - SUCCESS="true" if [[ "$#" -gt 2 ]] @@ -17,7 +15,7 @@ else for dir_chall in ${CHALLS_UNDER_DIR[@]} do - CHALL_LINE=$(grep -P "(?<=(\||\[))${dir_chall}(?=(\||\]))" $2) + CHALL_LINE=$(grep -P "(?<=(\||\[))$dir_chall(?=(\||\]))" $2 | cut -d '|' -f 2) if [[ -n $CHALL_LINE ]] then echo "[*] - SUCCESS : $dir_chall is Found in $2 file" @@ -45,5 +43,6 @@ else elif [[ $SUCCESS = "False" ]] then echo "[!] - ERROR : Checking Failed, Missing Challegnes in $2 File" + exit 1 fi fi \ No newline at end of file diff --git a/.gitlab/scripts/readme_file_checker.sh b/.gitlab/scripts/readme_file_checker.sh index e3b935d..7e914de 100755 --- a/.gitlab/scripts/readme_file_checker.sh +++ b/.gitlab/scripts/readme_file_checker.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -euo pipefail - SUCCESS="true" if [[ "$#" -gt 2 ]] @@ -17,7 +15,7 @@ else for dir_chall in ${CHALLS_UNDER_DIR[@]} do - CHALL_LINE=$(grep -P "(?<=(\||\[))${dir_chall}(?=(\||\]))" $2) + CHALL_LINE=$(grep -P "(?<=(\||\[))$dir_chall(?=(\||\]))" $2 | cut -d '|' -f 2) if [[ -n $CHALL_LINE ]] then echo "[*] - SUCCESS : $dir_chall is Found in $2 file" @@ -45,5 +43,6 @@ else elif [[ $SUCCESS = "False" ]] then echo "[!] - ERROR : Checking Failed, Missing Challegnes in $2 File" + exit 1 fi fi \ No newline at end of file