How to use pre-built GitHub Actions from the marketplace
actions/checkout, uses keyword, action versioning, @v4 pinning, GitHub Marketplace, verified creators, action inputs
What is a Pre-Built Action?
Pre-built Actions are reusable packages that encapsulate common automation tasks. Instead of writing shell scripts to check out code, set up Node.js, or upload artifacts, you reference a community or official Action with the uses key.
Using an Action
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ciThe format is owner/repo@ref. actions/checkout is maintained by GitHub. @v4 pins to the v4 major release tag โ this is safer than using @main which could introduce breaking changes.
Action Inputs
The with block passes named inputs to an Action. Each Action documents its available inputs in its README. actions/setup-node accepts node-version to control which Node release is installed and cache to automatically cache package manager dependencies.
Finding Actions
Browse github.com/marketplace?type=actions to discover community Actions. Prefer Actions from verified creators (checkmark badge) or from the actions organization. Always review the source code of third-party Actions before using them in production workflows.
