DEV Community

Cover image for Run GitHub Actions locally
Rajika Imal
Rajika Imal

Posted on

5 1

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.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay