generated from nhcarrigan/template
This commit is contained in:
@@ -49,7 +49,44 @@ else
|
||||
echo "Trigger \"$dupe\" found in:"
|
||||
grep -l "trigger: \"$dupe\"" "$MATCH_DIR"/*.y*ml
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
rm "$ALL_TRIGGERS"
|
||||
|
||||
### Now we test that all gifs.yml replace values match "c.tenor.com".
|
||||
|
||||
# Temporary file to store all replace values
|
||||
REPLACE_VALUES=$(mktemp)
|
||||
|
||||
# Read gifs.yml file and extract replace values
|
||||
echo "Scanning gifs.yml for replace values..."
|
||||
if [ -f "$MATCH_DIR/gifs.yml" ]; then
|
||||
# We match lines like: ` replace: "https://c.tenor.com/some-value/tenor.gif"`
|
||||
grep -E '^\s*replace:' "$MATCH_DIR/gifs.yml" | sed 's/.*replace:\s*"\([^"]*\)".*/\1/' >> "$REPLACE_VALUES"
|
||||
else
|
||||
echo "Error: gifs.yml file not found in $MATCH_DIR directory!"
|
||||
rm "$REPLACE_VALUES"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if we found any replace values
|
||||
if [ ! -s "$REPLACE_VALUES" ]; then
|
||||
echo "No replace values found in gifs.yml. Check file format."
|
||||
rm "$REPLACE_VALUES"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if all replace values start with "https://c.tenor.com/"
|
||||
echo -e "\nChecking replace values in gifs.yml..."
|
||||
INVALID_REPLACE=$(grep -v '^https://c\.tenor\.com/' "$REPLACE_VALUES")
|
||||
if [ -z "$INVALID_REPLACE" ]; then
|
||||
echo "Success: All replace values in gifs.yml are valid!"
|
||||
else
|
||||
echo "Error: Invalid replace values found in gifs.yml:"
|
||||
echo "$INVALID_REPLACE"
|
||||
fi
|
||||
|
||||
# This must always be the final line, so that CI can detect success. If you want to exit with a failure, do so at the conditional point.
|
||||
exit 0
|
||||
Reference in New Issue
Block a user