AI Hints
CI/CD with GitHub Actions · Lesson 22 of 138

Actions with uses

Reusable steps.

⏱ 2 min read▶ Video at 24:47🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

Some jobs are needed by almost every workflow. Getting the code, installing a language, caching files. Instead of writing those commands yourself, you use an action, a reusable step that someone has already written and tested.

Actions with uses
From the video: Actions with uses
  • Common jobs
  • Already written and tested
  • Reuse them

uses and with

Uses names the action. The part before the slash is the owner, here actions, which is GitHub itself. Then the repository name, and after the at sign, the version. With passes inputs to the action, like settings for a function. Here, which Python version to install.

uses.ymlyaml
steps:
  - uses: actions/checkout@v4

  - name: Set up Python
    uses: actions/setup-python@v5
    with:
      python-version: "3.12"

Reading an action name

Every action name has the same shape. Owner, slash, repository, at, version. Actions from the actions owner are made by GitHub. Others come from companies and the community, in the GitHub marketplace. Always pin a version, so a change to the action can't surprise you.

keyvalue
actions/checkoutowner / repository
@v4the version
with:inputs
Marketplacethousands more

Summary

Uses runs a ready made action, and with passes its inputs. Always pin a version. Next, the most used action of all, checkout.

Key takeaways
  • uses: owner/repo@version
  • with: inputs
  • Pin versions
Next up: checkout — getting your code