Testing GitHub Actions to trigger the WooCommerce Action Scheduler and scheduled WordPress Cron events via WP-CLI utilising the WP Engine SSH Gateway.
This implementation allows you to run WordPress cron jobs reliably using GitHub Actions and WP Engine's SSH Gateway. The solution runs both wp cron event run
and wp action-scheduler run
commands every 5 minutes.
- WP Engine hosting account
- GitHub repository
- SSH access to your WP Engine environment
- WP-CLI installed on your WP Engine environment (comes pre-installed)
-
Generate SSH Key
ssh-keygen -t ed25519 -f ~/.ssh/wpengine_ed25519
-
Add Public Key to WP Engine
- Go to https://my.wpengine.com/profile/ssh_keys
- Click "New SSH Key"
- Paste contents of
~/.ssh/wpengine_ed25519.pub
-
Add Private Key to GitHub
- Go to your GitHub repository settings
- Navigate to Secrets and Variables > Actions
- Create new secret named
WPE_SSHG_KEY_PRIVATE
- Paste contents of
~/.ssh/wpengine_ed25519
-
Create GitHub Action Workflow
- Create directory:
.github/workflows/
- Add file:
run-5-minutes.yml
with provided workflow content - Update
WPE_ENV
value to your WP Engine environment name
- Create directory:
-
Add Script File
- Create
script.sh
in repository root - Copy provided script content
- Make executable:
chmod +x script.sh
- Create
-
Test SSH Connection
ssh {your-environment}@{your-environment}.ssh.wpengine.net
-
Manually Trigger Workflow
- Go to Actions tab in GitHub repository
- Select "Run-5-Minutes" workflow
- Click "Run workflow"
-
Check Logs on WP Engine
- Connect via SSH
- View logs:
cd sites/{your-environment} tail -f action-scheduler-run.log tail -f cron-run.log
- GitHub Actions logs show execution status
- WP Engine logs track each run:
action-scheduler-run.log
- Action Scheduler tasksaction-scheduler-run-error.log
- Action Scheduler errorscron-run.log
- WordPress cron eventscron-run-error.log
- WordPress cron errors
- SSH key is stored securely in GitHub Secrets
- WP Engine SSH Gateway uses key-based authentication
- Script runs in isolated environment
- Logs are stored in site directory for accountability