How To Debug GitHub Actions With SSH
One feature that CircleCI has that I like is the ability to debug failed job runs via ssh.
It’s the one feature I thought GitHub Actions didn’t have until I found the debugging with ssh action.
This action replicates that feature from CircleCI. You can set it up so that you can ssh into your failed jobs like this:
- name: Setup upterm session
uses: lhotari/action-upterm@v1
if: ${{ failure() }}
with:
## limits ssh access and adds the ssh public key for the user which triggered the workflow
limit-access-to-actor: true
## If no one connects after 5 minutes, shut down server.
wait-timeout-minutes: 3
The one drawback is it’s not built into the platform like CircleCI’s feature. You should be explicit and set up this action when you need to debug inside a GitHub Actions runner.
If you set it up to always run when there’s a failure, even with a timeout, you could be spending a lot of extra money letting your runners sit around.
Master GitHub Actions with a Senior Infrastructure Engineer
As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.
Not sure yet? Check out the archive.
Unsubscribe at any time.