Project 2 β€Ί 01 Create your first workflowGitHub β†—
πŸ€– AI Prompt β€” stuck? paste this

β€œWrite a minimal GitHub Actions workflow that runs on every push, checks out the code with actions/checkout@v4, and prints 'Hello CI'. Explain each line.”

01 β€” Create your first GitHub Actions workflow

Category: Workflows Β· Priority: High Β· Step: 2

A "hello world" workflow that runs on every push. The goal is to see the pipeline turn green.

🎯 What is this task?

Workflows live in a special folder: .github/workflows/. Any .yml file there is picked up by GitHub automatically. In this task you create the smallest possible workflow so you can see it run in the Actions tab of your repo.

πŸ€– AI Prompt

"Write a minimal GitHub Actions workflow file that runs on every push to any branch, checks out the code, and prints 'Hello CI'. Explain each line."

πŸ“‹ Step-by-step

Step 1 β€” Create the folder and file

mkdir -p .github/workflows

Create .github/workflows/ci.yml:

name: CI

# Run on every push and pull request
on: [push, pull_request]

jobs:
  hello:
    runs-on: ubuntu-latest
    steps:
      - name: Check out the code
        uses: actions/checkout@v4

      - name: Say hello
        run: echo "Hello CI πŸ‘‹"

Step 2 β€” Commit and push

git add .github/workflows/ci.yml
git commit -m "ci: add first workflow"
git push

Step 3 β€” Watch it run

Open your repo on GitHub β†’ Actions tab. You'll see the CI workflow running. Click it to watch the logs stream in. A green βœ“ means it passed.

βœ… Done when

  • .github/workflows/ci.yml exists and is pushed
  • The workflow appears in the Actions tab
  • The run finishes green and prints Hello CI

πŸ“ Quiz

Answer all 2 questions correctly to complete this lesson.

1. Which key defines what triggers a workflow?
2. What does `uses: actions/checkout@v4` do?
← PreviousPass the quiz to completeNext β†’