I ended up using appleboy for this with a great deal of success:
https://github.com/appleboy/ssh-action
Answer from Nicole Staline on Stack OverflowVideos
Hi, is it possible to SSH into GCP VM instance from GitHub Actions using Workload Identity Federation (therefore use the Service Account tied to it)? Is it even recommended? I tried to use glcoud beta compute sshbut I still could not get it to work (I can provide the details if need be).
My hope is to not have to a use a GCP IAM User in my GitHub Actions workflow (which seems to be required if I want to use OS Login for ssh access). I also don't want to manually save a ssh key in my VM since I would have to do that every time I recreate the VM.
NOTE: I am using terraform and OS Login for bringing up the VM and running commands on it. This is not incorporated into my GitHub actions workflow. In my GitHub actions workflow, I only intend to push a new docker image to registry, SSH into the VM, pull the new Docker image, and recreate the container.
Would appreciate any help, thank you!