steps
run:
Executes a shell command on the runner. Multi-line scripts run in a single shell invocation; the shell is chosen by `shell:` (or workflow `defaults`) and defaults to bash on Linux/macOS and pwsh on Windows.
- run: <command> | |
multi-line script Common values / subkeys
| Value / Subkey | Purpose |
|---|---|
| shell | bash | sh | pwsh | powershell | python | cmd | custom |
| working-directory | cd into this directory before running |
| env | Step-scoped environment variables |
| continue-on-error | Do not fail the job if the step fails |
| id | Enable `steps.<id>.outputs`, `.outcome`, `.conclusion` |
| name | Display label shown in the log |
| timeout-minutes | Fail the step if it exceeds N minutes |
Examples
- name: Test
run: npm test Single-line command with a display name
- id: build
run: |
npm ci
npm run build
echo "dist=out" >> "$GITHUB_OUTPUT"
env:
NODE_ENV: production
working-directory: app Multi-line, id + env + working-directory, emits an output
- run: Write-Host "hello $env:USER"
shell: pwsh PowerShell script on any OS
- id: test
continue-on-error: true
run: npm test
- if: steps.test.outcome == 'failure'
run: ./notify.sh React to a soft-failed step via `outcome`
Gotcha
Bash runs with `set -eo pipefail` by default — a failing command in a pipe fails the step; interpolating `${{ github.event.* }}` directly into a script is a script-injection risk, pass values via `env` instead.
Related keywords
env:
Defines environment variables for a scope. Declared at the workflow, job, or step level and read back via the `env` context or as real environment variables inside `run:` scripts.
outputs:
Declares values a job exposes to downstream jobs that `needs:` it. Values are usually pulled from step outputs written to `$GITHUB_OUTPUT`.
uses:
Runs a published action inside a step. The reference should include an immutable commit SHA or a version tag; inputs are passed via the `with:` block.