TIL - Debugging GitHub Actions

Have you ever spent 20+ commits to debug a CI setup? Yes?

EDIT: As pointed out by follow redditors, sshing into a GitHub actions runner might cause trouble with GitHubs TOS.

A better alternative to this approach is act, a handy CLI tool which allows us to run our Actions workflow locally. It uses Docker containers to replace build machines (only Linux is supported at the moment), so we're still able to debug our workflow without having to play the endless commit ping-pong.

Wanted to ssh into the build machine to check some things?
We were facing the same situation today and were happy to discover mxschmitt/action-tmate@v2.
This action allows you to ssh into the runner executing your workflow to manually verify your build.

It will install and start tmate, which allows you to join the running terminal session, so it's possible to either connect via ssh or web terminal. Connection details will be printed in the command output.
mxschmitt/action-tmate@v2 allowed us to identify the root cause of our problem and we were able to fix our build quickly, a huge win in terms of debuggability!