Lesson 7 / 25
Steps: uses and run
Actions and shell commands.
Building blocks of a job
Steps run sequentially on the same runner and share its filesystem. A uses step runs an action (from the Marketplace, another repository, or a local path) configured with with: inputs; a run step executes shell commands (bash on Linux and macOS by default, with set -e behaviour so a failing command fails the step). Steps can set env, if conditions, id for referencing outputs, continue-on-error, timeout-minutes and working-directory. Use multi-line run: | blocks for scripts.
Compose pipelines
Steps run in order inside a job; needs orders jobs; outputs and artifacts move data between them.
Common step patterns
Not linted or run here; check the GitHub Actions documentation for current syntax.
steps:
- uses: actions/checkout@v4 # get the code
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install and test
working-directory: api
env:
PYTHONDONTWRITEBYTECODE: "1"
run: |
pip install -r requirements.txt
pytest -qUse run: | for anything with colons
Block scalars avoid YAML parsing surprises; an unquoted "echo New issue: x" line broke this course's own example until it was rewritten.
Quick check: What is the difference between uses and run?
- uses runs a packaged action; run executes shell commands
- They are identical
- run only works on Windows
- uses only installs Node.js
Answer
uses runs a packaged action; run executes shell commands — Actions versus scripts.