Create GitHub Actions Workflows with a CLI AppJanne Kemppainen |
GitHub Actions workflows are defined as YAML files that can contain various configurations. Sometimes it can be difficult to remember all the available options. That’s why I created a handy little tool called Actions Workflow!
Actions Workflow is a Node.js command line application that automates the workflow YAML creation. You run it from the repository root directory, answer a set of questions on the conversational user interface, and finally get the end result automatically stored to the correct location in your repository.
All you need is a recent enough version of Node.js, and then you can run the app from the command line with
$ npx actions-workflow
You can see it in action here:
The application asks basic questions such as the filename and the name of the new workflow.
The interesting part starts when we get to the events. You can choose one or more events that should trigger the workflow. After this you also get to choose the needed activity types for each event, so you don’t have to go to the GitHub documentation to check the available options!
Next you define what jobs you want to create. You configure each job with the runner environments, and you have the option to checkout the repository as well as set up different programming language environments. This makes it easy to add steps for actions/checkout or actions/setup-python, for example. Each choice even includes the relevant configuration options.
When you define many jobs the later jobs can depend on the previous ones. Configuring this is as easy as toggling a checkbox.
A job can run on multiple runner types. If you choose more than one runner environment the needed matrix build will be automatically configured for you. Therefore you don’t need to remember how matrix builds are configured!
The tool is obviously open source, so feedback, fixes and new features in the form of pull requests are always welcome. I hope you find my little tool useful!