mirror of https://github.com/actions/cache.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
581 B
Bash
30 lines
581 B
Bash
5 years ago
|
#!/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)"
|
||
|
echo "File content:\n$content"
|
||
|
if [ -z "$(echo $content | grep --fixed-strings "$prefix $GITHUB_RUN_ID")" ]; then
|
||
|
echo "Unexpected file content"
|
||
|
exit 1
|
||
|
fi
|