Browse Source
refactor: improve game icon validation script
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.
pull/4345/head
Daniel Gibbs
2 years ago
No known key found for this signature in database
GPG Key ID: 2076B128385E8C55
1 changed files with
13 additions and
1 deletions
.github/workflows/serverlist-validate-game-icons.sh
@ -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 ) "