The gravitational action in asymptotically AdS and flat space-times