GitHub Action for Using the ASK CLI and Bespoken Tools | VPS and VPN
HostArmada - Affordable Cloud SSD Web Hosting

GitHub Action for Using the ASK CLI and Bespoken Tools

It is always good practice in the world of programming to try to develop things that are reusable. So anyone can integrate what has been developed and can quickly start using it.

This is the philosophy behind a GitHub Action. Small individual and reusable tasks that we can combine to create jobs and customize our GitHub Actions workflows.


Here are the technologies used in this project:

  1. Amazon Developer Account – How to create an account
  2. AWS Account – Sign up here for free
  3. ASK CLI – Install and configure ASK CLI
  4. GitHub Account – Sign up here for free
  5. Visual Studio Code

The Alexa Skills Kit Command Line Interface (ASK CLI) is a tool for us to manage our Alexa Skills and its related resources, such as AWS Lambda functions. With the ASK CLI, we have access to the Skill Management API, which allows us to manage Alexa Skills through the command line.

GitHub Actions


GitHub Actions helps us to automate tasks within the software development lifecycle. GitHub Actions is event-driven, which means that we can run a series of commands after a specific event has occurred. For example, whenever someone creates a pull request for a repository, we can automatically run a pipeline on GitHub Actions.

An event automatically triggers the workflow, which contains one or more jobs. Then the jobs use steps to control the order in which the actions are executed. These actions are the commands that automate certain processes.

GitHub Action to Run ASK CLI and Bespoken Commands

Github action

An Action is an individual task that we can combine to create jobs and customize our GitHub Actions workflows. We can create our own Actions or use and customize Actions shared by the GitHub community.

We can create an Action by writing custom code that interacts with the repositories in any way we want, including integrating with GitHub APIs and any publicly available third-party APIs. For example, an Action can publish npm modules, send SMS alerts when there is an urgent problem in the pipeline, or deploy our code if it is ready for production.

To share the Actions that we have created, the repository must be public.

Actions can be run directly on a machine or in a Docker container. We have to define the inputs, outputs and environment variables of an Action.

With eveyrthing explained, let’s look at the GitHub Action configuration file found in the action.yml file.

As seen in the previous file, the GitHub Action has as input a parameter called command which will be the ASK CLI or Bespoken command that we want to execute. This command will run on a specific docker container whose Dockerfile is specified in the run section of the GitHub Action. This Docker executor will be passed the command entered through the command input parameter for later execution and will return the result of the execution in the result output parameter of the GitHub Action.

This GitHub Action is based on the Docker image that we have been using throughout the series of posts about Devops and you can find here. Note that this image already has the ASK CLI, the Bespoken Tools, Python, Git, the AWS CLI, among others installed.

However, this new Docker image that GitHub Action uses extends from the original Docker image previously commented.

This second Docker image is exactly the same as the one mentioned but an entrypoint has been added to it.

This new Docker image can be found in .github/action/Dockerfile:

The new entrypoint that we have added to this new Dockerfile, the only thing it will do is execute the command that is passed through the input parameter of the GitHub Action called command:

As output, the entrypoint will return the result of the execution of the command received from the GitHub Action through the command parameter in the format required by GitHub.

This format is as follows:::set-outpt name={ID_OUTPUT_PARAMETER}::{VALUE_OUTPUT_PARAMETER}.

NOTE: It is important to add that the GitHub Action uses the latest version of ASK CLI.

Example of Use

We can use the following example:

NOTE: It is important to mention that to run the GitHub Action we must pass all the environment variables that the ASK CLI needs as seen in the previous example.

Using the Action in a GitHub Actions Workflow

This is an example of how GitHub Action can be integrated into a GitHub Actions workflow:

Test the GitHub Action On Every Commit

In turn, we have created a GitHub Actions workflow that its only purpose is to verify that the Action works in each new commit made to the repo. Thus we can detect that the new changes that are made will not break the current behaviour of the Action.

This workflow can be found in .github/workflows/main.yaml:

As you can see, in the uses property of the Test action step of the workflow, it is forced to take the Action from the repository root directory (./) Instead of taking it from the marketplace version (xavidop/[email protected])



By creating this GitHub Action we enable any developer to execute commands from the ASK CLI and Bespoken and thus to automate their Alexa Skills processes in a very simple way by creating GitHub Actions workflows.

You can find the code in my GitHub and the GitHub Action on the official GitHub Actions marketplace.

That’s it!

I hope you find it useful! If you have any doubts or questions, feel free to contact me or post a comment below.

Happy coding!

Feel free to join to the Voice Devs Community by clicking here.

Leave a Reply

Your email address will not be published. Required fields are marked *