From c4f9b1d2cf73689355fa226acb52b98a1dac9e60 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 16 Oct 2023 18:57:41 +0100 Subject: [PATCH] refactor: improve serverlist validation script The commit refactors the serverlist validation script to include a new check. It now compares all game servers listed in `serverlist.csv` to `$shortname-icon.png` files in `lgsm/data/gameicons`. If a game server is listed in `serverlist.csv`, it should have a corresponding `$shortname-icon.png` file. The commit adds a loop that checks for the existence of these files and outputs an error message if any are missing. --- .github/workflows/serverlist-validate.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/serverlist-validate.sh b/.github/workflows/serverlist-validate.sh index bc192ec37..0e56685c4 100755 --- a/.github/workflows/serverlist-validate.sh +++ b/.github/workflows/serverlist-validate.sh @@ -19,4 +19,19 @@ for csv in $csvlist; do fi done +# Compare all game servers listed in serverlist.csv to $shortname-icon.png files in lgsm/data/gameicons +# if the game server is listed in serverlist.csv then it will have a $shortname-icon.png file + +# loop though shortname in serverlist.csv +echo "Checking that all the game servers listed in serverlist.csv have a shortname-icon.png file" +for shortname in $(tail -n +2 serverlist.csv | cut -d ',' -f1); do + # check if $shortname-icon.png exists + if [ ! -f "gameicons/${shortname}-icon.png" ]; then + echo "ERROR: gameicons/${shortname}-icon.png does not exist" + exitcode=1 + else + echo "OK: gameicons/${shortname}-icon.png exists" + fi +done + exit ${exitcode}