Running GitHub Actions Locally
Section titled “Running GitHub Actions Locally”This project includes scripts to run GitHub Actions workflows locally using act.
Prerequisites
Section titled “Prerequisites”Install act:
# macOSbrew install act
# Linuxcurl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
# Windows (via Chocolatey)choco install act-cliAvailable Scripts
Section titled “Available Scripts”Run these from the root directory:
# List all available workflowsnpm run act:list
# Run the main CI workflownpm run act:ci
# Simulate a push event (runs workflows triggered by push)npm run act:push
# Simulate a pull request eventnpm run act:pr
# Run with custom optionsnpm run act -- [options]Common Use Cases
Section titled “Common Use Cases”Test CI Before Pushing
Section titled “Test CI Before Pushing”npm run act:ciDebug a Specific Job
Section titled “Debug a Specific Job”npm run act -- -j test -W .github/workflows/ci.ymlUse a Different Runner Image
Section titled “Use a Different Runner Image”npm run act -- --platform ubuntu-latest=nektos/act-environments-ubuntu:22.04- Act uses Docker to simulate GitHub Actions runners
- Some GitHub-specific features may not work locally (like secrets)
- For secrets, create a
.secretsfile in the root (gitignored) - Moon is installed as part of the workflow steps