I was just chatting with my good friend Anthony Chu about containers and an idea struck me - I love GitHub Actions, I love PowerShell. I wonder if the two would work together?
Dockerfile- the definition of the container within which the action is executed.
entrypoint.sh- the shell script that is executed when the Action is bootstrapped.
In our case, we will change things up a bit, and instead of
entrypoint.sh we’ll have
entrypoint.ps1. To make sure we can use PowerShell Core within the entrypoint script, we also need to do some preparation work within the
Dockerfile itself. That preparation is the installation of PowerShell - your
Dockerfile will end up looking like this:
That’s it - there is no additional configuration needed. Notice that compared to standard GitHub Actions examples, I’ve just replaced the bash script with the PowerShell script.
Will that work? Let’s put something basic in
Now, in the repository where we need to use, we can configure a workflow that points to the action, and do a “dummy” commit:
If you are more comfortably writing PowerShell than bash scripts - you too can take advantage of GitHub Actions!