28/71
Sign inSign up free

801. Bundle Repeated Setup Steps Into an Action

medium 20 XP ~10 minHands-on lab

Every job in /home/student/repos/data-pipeline/.github/workflows/ci.yml starts with the same three steps after checkout: set up Python, install the pinned tools, and print the versions. The Python version differs per job.

Task

  • Create a composite action in .github/actions/setup-tools/action.yml with an input python-version (default '3.12') that runs those three steps, using the input for actions/setup-python.
  • In ci.yml, replace the three steps in every job with a single step that uses ./.github/actions/setup-tools, passing the job's Python version. Keep the checkout step before it and each job's own steps after it.

Shell steps inside a composite action must declare their shell.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.