loading...
Cover image for Run GitHub Actions locally

Run GitHub Actions locally

rajikaimal profile image Rajika Imal ・1 min read

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

Usage

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

To confirm this run,

$ act -l

To run all

$ act

To run a specific job, use -j flag,

$ act -j test

To invoke an event,

$ act pull request

The complete list of flags are available here.

Posted on by:

rajikaimal profile

Rajika Imal

@rajikaimal

Senior Software Engineer at 99X Technology

Discussion

pic
Editor guide