1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-04-20 11:46:22 +02:00
cache/__tests__/verify-cache-files.sh

31 lines
583 B
Bash
Raw Normal View History

2020-02-13 12:38:56 -05:00
#!/bin/sh
# Validate args
prefix="$1"
if [ -z "$prefix" ]; then
echo "Must supply prefix argument"
exit 1
fi
# Sanity check GITHUB_RUN_ID defined
if [ -z "$GITHUB_RUN_ID" ]; then
echo "GITHUB_RUN_ID not defined"
exit 1
fi
# Verify file exists
file="test-cache/test-file.txt"
echo "Checking for $file"
if [ ! -e $file ]; then
echo "File does not exist"
exit 1
fi
# Verify file content
content="$(cat $file)"
2020-03-21 10:57:58 +09:00
printf "File content:\n%s\n" "$content"
if ! echo "$content" | grep --fixed-strings "$prefix $GITHUB_RUN_ID"; then
2020-02-13 12:38:56 -05:00
echo "Unexpected file content"
exit 1
2020-03-21 10:57:58 +09:00
fi