Workflow Syntax
name: workflow_name
Define workflow name
on: [push, pull_request]
Specify events that trigger workflow
jobs: job_id: runs-on: ubuntu-latest
Define job and runner
steps: - uses: actions/checkout@v2
Checkout repository code
run: command
Execute shell command
Workflow Commands
::set-output name=key::value
Set output parameter
::add-path::/path/to/dir
Add directory to PATH
::add-mask::value
Mask a value in logs
::error file=file,line=line,col=col::message
Create error annotation
::warning file=file,line=line,col=col::message
Create warning annotation
Environment Variables
${{ github.event_name }}
Name of the event that triggered workflow
${{ github.sha }}
Commit SHA
${{ github.ref }}
Git ref (e.g., refs/heads/main)
${{ github.repository }}
Repository name with owner
${{ secrets.SECRET_NAME }}
Access repository secrets
CLI Commands
gh workflow list
List workflows
gh workflow view [workflow]
View workflow details
gh workflow run [workflow]
Run a workflow
gh workflow disable [workflow]
Disable a workflow
gh workflow enable [workflow]
Enable a workflow
Testing Locally
act
Run GitHub Actions locally using nektos/act
act push
Run push event workflows
act pull_request
Run pull request event workflows
act -j job_id
Run specific job