World map

 

BM: Baca dalam Bahasa Melayu

World 7: Robots: Actions & CI/CD

Inside a workflow file

You will learn: the parts of a workflow file, and how to write one.

The problem

cat shows ci.yml: name CI, on push, then one job called test. It runs on ubuntu-latest and has four steps. Terminal output: $ cat .github/workflows/ci.yml name: CI on: push jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/setup-node@v7 with: node-version: 24 - run: npm ci - run: npm test

This file is a workflow: A YAML file in .github/workflows/ that tells the robot when and what to run.: a to-do list for a robot. It is written in YAML: A simple text format made of keys, colons and spaces. Workflows use it.. Looks scary? Read it as three parts: when, where, what.

Watch

Tap the line that says when the robot wakes up.

0 of 1 found

When: on: names the trigger (event): What wakes a workflow up, like a push, a pull request or a clock.. It says when the workflow runs. Here, on every push.

Watch

Where: under jobs: sits a job: A group of steps that runs on one fresh computer., a group of steps on one computer. What does runs-on: ubuntu-latest ask for?

Pick one answer.

Watch

What: a job has step: One task in a job: a command (run) or a ready-made action (uses).. They run in order, top to bottom. uses: borrows a ready-made action. run: types a command.

Drag a card into a box. Or tap the card, then tap the box.

      Try it

      Your turn. Build a workflow that tests every push.

      Tap blocks to add them. Put them in order.

      Blocks

      Your workflow

      Tap a block above to start.

      Workflow file .github/workflows/

      name: CI
      

      What runs

      Nothing to run yet.

      Predict

      You move run: npm test above the checkout step. What happens?

      Pick one answer.

      Try it

      A workflow is just a file in your repo. Save it with Git, like any other file.

      Working folder
      Staging area
      • Empty
      Repository
      • 3 save points
      • Ignore log files
      • Add day 1 page
      • Add README

      You did it!

      You can now read and write a workflow file.

      Go deeper (optional)

      Make it real (optional). Open your diary repo on GitHub. In its Actions tab, pick a simple starter workflow and commit it. Wait a minute, then check here.

      Check it on GitHub

      Your username is sent only to api.github.com.

      • A workflow ran in your diary repoNot checked yet