What Is an Action in GitHub Actions?
An action is a reusable building block. You call it from a step with uses: instead of writing the same shell commands yourself.
The word "Actions" in GitHub Actions comes from actions: small, shareable programs that do common tasks like checking out code or setting up a language. They are the unit of reuse in the ecosystem.
What it is
An action is a packaged piece of automation published to a repository or the Marketplace. You reference it by owner/name@version in a step's uses: field.
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20How it works
When a step uses an action, GitHub fetches the action at the pinned version and runs it on the runner, passing any with: inputs. The action can read inputs, run code, and set outputs.
Three flavors
- JavaScript actions run a Node program directly on the runner.
- Docker actions run inside a container image.
- Composite actions bundle several steps into one reusable action.
Why it matters
Actions save you from re-implementing common tasks and encode best practices. Pinning to a specific version (or commit SHA) keeps builds reproducible and secure.
Related concepts
Actions are called from steps, configured with inputs, and the most popular ones live in the GitHub Marketplace.
Key takeaways
- An action is a reusable unit called with
uses:. - Flavors are JavaScript, Docker, and composite.
- Pin versions for reproducible, secure builds.