Recently I had the tricky task of getting Behat to run as a CI step in a github actions file. Behat can be tricky enough to get working on a host, but doing it as part of CI is even harder if you can’t dig into any problems.
The solution? Creating an upterm session so that we can SSH onto the docker instance. We simply add the following step to our github actions file:
– name: Setup upterm session
If we then trigger the action via a commit and push, we can see the connection info against the job’s step:
If we copy the value against the “SSH Session:” field and paste that into a terminal (OSX, Linux only) we can SSH on to the Github actions docker container — e.g:
$ ssh mLKGffdkblkjGSDFMGSDFM3423BVBMemail@example.com
NOTE: Using this technique with a public repository may allow anyone to SSH onto the docker instance whilst the action is running. I’m not sure it’s a huge issue though as that docker instance only exists to satisfy the current run of the action. Each time github actions runs, you will get a new docker instance and a new SSH key.