I found act tool that aims to do just that: https://github.com/nektos/act

Install

There are multiple options to install it, but I chose to use it as a GitHub CLI extension:

gh extension install https://github.com/nektos/gh-act

After that the gh act command is available in the terminal.

How to run a specific workflow

To list all available jobs:

gh act -l

The output can be something like:

Stage  Job ID  Job name  Workflow name    Workflow file         Events
0      deploy  deploy    Publish Docs     publish_docs.yaml     push  
0      apply   apply     Terraform Apply  terraform_apply.yaml  push

To run specific job:

gh act push -j apply -n

where:

  • push - a name of the event,
  • -j apply - run the job with id apply,
  • -n - dry run.

How to pass secrets

  • gh act -s MY_SECRET=somevalue
  • gh act -s MY_SECRET - check for an environment variable named MY_SECRET and use it if it exists. If the environment variable is not defined, prompt the user for a value.
  • gh act --secret-file my.secrets load secrets from my.secrets file

===Couldn’t proceed with this. Some quirks with vars were present.===