This repository contains a local GitHub Action that echoes environment variables and demonstrates how to test it using ACT.
actiontest/
├── .github/
│ └── workflows/
│ └── test.yml # Workflow to test the action
├── myaction/ # Your custom action
│ └── action.yml # Action definition
└── README.md # This file
The myaction action:
- Displays a custom message
- Lists all environment variables (sorted)
- Shows the count of environment variables
- Highlights GitHub-specific environment variables
# On macOS with Homebrew
brew install act
# Or download from GitHub releases
# https://github.com/nektos/act/releases-
Test the default workflow:
act
-
Test specific job:
act -j test-action
-
Test with specific event:
act push
-
Test with verbose output:
act -v
-
Test with specific runner:
act -P ubuntu-latest=catthehacker/ubuntu:act-latest
# List available workflows and jobs
act -l
# Dry run (don't actually run, just show what would run)
act -n
# Run with secrets file
act --secret-file .secrets
# Run specific workflow file
act -W .github/workflows/test.ymlCreate a .secrets file in the root directory:
GITHUB_TOKEN=your_token_here
CUSTOM_SECRET=secret_value
custom-message: Custom message to display before environment variables (optional)
env-count: Number of environment variables found
The workflow tests the action on multiple operating systems:
- Ubuntu (Linux)
- Windows
- macOS
Each job sets up custom environment variables and then runs the action to display all environment variables.
When you run the action, you should see:
- Your custom message
- A sorted list of all environment variables
- The total count of environment variables
- GitHub-specific environment variables (if any)
If ACT fails to run:
- Make sure Docker is running
- Check that you have the correct permissions
- Try running with
act -vfor verbose output - Ensure your workflow YAML is valid