Skip to content

Instantly share code, notes, and snippets.

@jaredh159
Created October 1, 2021 14:19
Show Gist options
  • Save jaredh159/634285e52456fefc9f04fb2b4bd3af28 to your computer and use it in GitHub Desktop.
Save jaredh159/634285e52456fefc9f04fb2b4bd3af28 to your computer and use it in GitHub Desktop.
wait for macOS postgres to start in github action
- name: start postgres
run: |
brew services start postgresql
echo "Check PostgreSQL service is running"
i=20
COMMAND='pg_isready'
while [ $i -gt 0 ]; do
echo "Check PostgreSQL service status"
eval $COMMAND && break
((i--))
if [ $i == 0 ]; then
echo "PostgreSQL service not ready, all attempts exhausted"
exit 1
fi
echo "PostgreSQL service not ready, wait 3 more sec, attempts left: $i"
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment