Skip to content

Commit

Permalink
refactor: improve game icon validation script
Browse files Browse the repository at this point in the history
The commit refactors the game icon validation script to improve its functionality. It adds a check for unexpected game icons and ensures that the number of game icons matches the number of servers in serverlist.csv. The commit also updates error messages for better clarity and readability.
  • Loading branch information
dgibbs64 committed Oct 16, 2023
1 parent e460991 commit ad3453e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/serverlist-validate-game-icons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ for shortname in $(tail -n +2 serverlist.csv | cut -d ',' -f1); do
fi
done

echo ""
echo "Checking if an unexpected gameicon exists"
for gameicon in $(ls -1 gameicons); do
# check if $gameicon is in serverlist.csv
if ! grep -q "${gameicon%-icon.png}" serverlist.csv; then
echo "ERROR: gameicon ${gameicon} is not in serverlist.csv"
exitcode=1
else
echo "OK: gameicon ${gameicon} is in serverlist.csv"
fi
done

# check that the number of gameicons matches the number of servers in serverlist.csv
echo ""
echo "Checking that the number of gameicons matches the number of servers in serverlist.csv"
gameiconcount="$(ls -1 gameicons | wc -l)"
serverlistcount="$(tail -n +2 serverlist.csv | wc -l)"
if [ "${gameiconcount}" -ne "${serverlistcount}" ]; then
echo "ERROR: game icons (${gameiconcount}) does not match serverlistcount ($serverlistcount)"
echo "ERROR: game icons (${gameiconcount}) does not match serverlist.csv ($serverlistcount)"
exitcode=1
else
echo "OK: gameiconcount ($gameiconcount) matches serverlistcount ($serverlistcount)"
Expand Down

0 comments on commit ad3453e

Please sign in to comment.