---
# System prepended metadata

title: Run Github Action Locally

---

# Run Github Action Locally
`act` is a tool to run github action locally. By using `act`, we can get feedback from CI faster. No need to `commit/push` any changes to github for checking your code is fulfilling the CI requirements or not.


## Installation
### MacOS
1. Using homebrew to install `act`
```bash=
brew install act
```

2. Install Docker
`act` depends on docker to run github workflows. Follow the steps in [Docker Docs for how to install Docker Desktop for Mac](https://docs.docker.com/desktop/mac/install/).

### Other Operating Systems
Please refer to [here](https://github.com/nektos/act#installation) to install it on your operating systems.

## Running
Following is the command to run `act`.
```bash=
act \
--container-architecture <architecture-name> \
-P <platform>=<image> \
-W ./.github/workflows/<workflow-name>.yml \
--secret-file <file path> \
--rm
```
Optional Flags:
* **`--container-architecture`**
Architecture that should be used to run containers. If not specified, will use host default architecture. For MacOS M1 chip, you must specify `linux/amd64`.

* **-P**
Custom `image` to use for each platform. `<platform>` is the OS you assigned in workflows, like `ubuntu-latest`. `<image>` is the image you want to run a container for github action.
Notice that `MacOS` and `Windows` are not supported so far.

* **-W**
Path of the workflow. Will run all workflows if not specified.

* **`--secret-file`**
Path of the file with a list of secrets to read from. Default path will be `.secrets`.
    * Secrets file format
    ```
    <SECRET_KEY_NAME1>=<SECRET_KEY_VALUE1>
    <SECRET_KEY_NAME2>=<SECRET_KEY_VALUE2>
    ```
* **`--rm`**
Remove the container `act` built just before the exit.

#### Sample command
```bash=
act \
--container-architecture linux/amd64 \
-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest \
-W ./.github/workflows/quality_check.yml \
--secret-file ./config/.secrets \
--rm
```

For more information, please refer to reference 1.

## Reference
[1] [nektos/act](https://github.com/nektos/act)