GitHub Actions33 commands
GitHub Actions Cheat Sheet
Essential GitHub Actions syntax for workflows, jobs, steps, secrets, matrices, caching, and reusable actions.
Workflow Triggers
| Command | Description |
|---|---|
| Trigger on any push |
| Trigger on push to main |
| Trigger on PR events |
| Run every Monday at 9 AM UTC |
| Manual trigger with button |
| Trigger on new release |
Job Syntax
| Command | Description |
|---|---|
| Run on latest Ubuntu |
| Job depends on other jobs |
| Conditional job execution |
| Matrix build across versions |
| Set job timeout |
| Prevent concurrent runs |
Common Steps
| Command | Description |
|---|---|
| Check out repository code |
| Set up Node.js |
| Cache dependencies |
| Upload build artifact |
| Download artifact in later job |
| Run shell commands |
Secrets & Variables
| Command | Description |
|---|---|
| Access repository secret |
| Access repository variable |
| Current commit SHA |
| User who triggered workflow |
| PR number |
| Access environment variable |
Deployment Patterns
| Command | Description |
|---|---|
| Use deployment environment |
| Set environment URL |
| Set OIDC permissions |
| AWS OIDC auth |
| Deploy only on success + main |
gh CLI in Actions
| Command | Description |
|---|---|
| Comment on PR |
| Create release with notes |
| List deployments via API |
| Auto-provided token for gh |