# Local Execution of GitHub Workflows: Easy Guide

Have you ever wondered about testing GitHub workflows before pushing them into the repository and hoping they don't fail? Then you've come to the right place.

## *Act* Before You Push

I use [act](https://github.com/nektos/act) to test GitHub workflows all the time, and I can't count how many times it has saved me.

To get started, install act using brew,

```bash
brew install act
```

It helps you do many things, including:

* Running your GitHub workflow in a specific container allows you to simulate the exact environment your workflow will run in, ensuring consistency and reducing the chances of unexpected failures.
    
    * ```bash
          act -P ubuntu-latest=catthehacker/ubuntu:act-latest
        ```
        
* Run a specific workflow to test individual parts of your GitHub Actions, ensuring each component works as expected before integrating them into the main workflow.
    
    * ```bash
          act -P ubuntu-latest=catthehacker/ubuntu:act-latest push
        ```
        
* Pass secrets if required, ensuring that sensitive information is securely handled during the workflow execution.
    
    * ```bash
          act -P ubuntu-latest=catthehacker/ubuntu:act-latest -s GITHUB_TOKEN=f4bhuj2gb5trhigbihfgbti4h2 push
        ```
        

You can learn more about the act CLI from the repository below:

%[https://github.com/nektos/act]
