Pumped Milk

Can I pump milk on Shabbat and use it to feed my baby on Shabbat?
(My baby does not take formula and I am running out of extra supply).

See here

I am not OP, however, if a baby doesn’t take formula wouldn’t this be pikuach nefesh?
What if when you connect the pump there is no bottle so it is being wasted at the time it is turned on. But then right after attach the bottle so that it can be saved?

You would need to have the pump turn on after the pump and bottle is attached.
If it’s a question of sakana then you can turn on pump yourself. There are drinks that babies can have if mother’s milk isn’t available. That would not constitute sakana unless the baby is not well. That would depend on each situation