updated script to check if a push is needed