DEV Community 👩‍💻👨‍💻

Cover image for Run GitHub Actions locally
Rajika Imal
Rajika Imal

Posted on

Run GitHub Actions locally

GitHub Actions are a great way to run continuous integration and continuous deployment tasks. Actions are defined using YAML files and there are tons of existing ones which you can use to develop a pipeline. However Actions should be run on GitHub to know the output, which means at development it is not possible to run Actions and test them.

act provides a way to run Actions locally. This simplifies the development of actions and running them locally. Therefore this gives faster feedback for the developer.

Installation

$ brew install nektos/tap/act #for macOS
$ curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
$ choco install act-cli #for choco
$ scoop install act #for scoop
Enter fullscreen mode Exit fullscreen mode

Usage

Make sure you have Actions defined in .github/workflows/ directory

To confirm this run,

$ act -l
Enter fullscreen mode Exit fullscreen mode

To run all

$ act
Enter fullscreen mode Exit fullscreen mode

To run a specific job, use -j flag,

$ act -j test
Enter fullscreen mode Exit fullscreen mode

To invoke an event,

$ act pull request
Enter fullscreen mode Exit fullscreen mode

The complete list of flags are available here.

Top comments (0)

DEV

Thank you.

 
Thanks for visiting DEV, we’ve worked really hard to cultivate this great community and would love to have you join us. If you’d like to create an account, you can sign up here.