Git & GitHub·Team workflow

GitHub Actions

Run tests automatically on every pull request and protect main.

Beginner 13 min read Lesson 14 of 480 Challenge included
What you will be able to do
  • Read a workflow file
  • Understand triggers, jobs and steps
  • Keep secrets out of logs

GitHub Actions runs workflows from .github/workflows. A workflow listens for events, runs jobs on a runner and executes steps such as installing dependencies and testing.

ci.ymlYAML
name: CI

on:
  pull_request:
  push:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm test
ConceptPurpose
onEvents that trigger the workflow
jobsIndependent work run on a runner
stepsCommands and reusable actions in order
secretsEncrypted values injected at runtime
branch protectionRequire checks before merging
Your turn

Add a lint step

Easy

Extend the CI workflow so lint runs after dependencies are installed and before tests.

BASH · starter
      - run: npm ci
      - run: npm test
Check your understanding before moving on.
Knowledge checkQuestion 1

Where does a GitHub Actions workflow live?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: How Git stores history
Lesson 14 of 480 · 0% of course