EDIT (02/03/2021): You can use tmate action inside a Windows runner.
If you are using GitHub Actions, you have four choices for the runner:
- Windows Runner
- Ubuntu Runner
- MacOS Runner (Preview)
- Self-Hosted Runner
GitHub Actions for Microsoft Power Platform support only Windows Runner (as of Dec 2020). If you are building some workflows using the GitHub hosted runner, the only way you can troubleshoot the workflow is by using the logs, that can be turned on using the ACTIONS_RUNNER_DEBUG and ACTIONS_STEP_DEBUG environment variables.
You cannot use act
or tmate because you are using Windows Runner. One way to work around the jam is to use self-hosted runner, if you are troubleshooting the Action. Rather than configuring the runner on your local machine, what if you could run it inside a container? This way you can run multiple runners on the same machine, all using the same underlying Windows Servercore image.
You need to install the following in your local machine:
During or after installation of Docker, switch to Windows Container, rather than Linux containers, as we need to use the Windows Servercore image. Now, clone this repo https://github.com/rajyraman/docker-github-self-hosted-runner on your local machine. Next, go to https://github.com/settings/tokens and create a Personal Access Token with repo scope.
Once you have the token, you can run the runner-setup PowerShell script to create the environment file for the container that has the repo url where the Actions with self-hosted runner will run, and the personal access token required to connect to the GitHub API.
Now run docker-compose up –build and you should see the container being built and started with the GitHub Runner.
You should now be able to see the runner on the repo that you setup the env file for.
Now let us create a new workflow that utilises the self-hosted runner. The key this here is to mention the self-hosted runner on “runs-on”.
Since this workflow uses workflow_dispatch trigger, you can run it manually. If you now run the workflow, you should start see the logs appear on the container’s console.
With the latest version of the Docker extension for VSCode, you can also explore the container’s file system, which is quite handy, in case you want to inspect the artifacts produced by the workflow.
I hope this tip will help you when you are stuck building workflows with Power Platform Actions.