← Learning Hub
Advanced

GitHub Actions and Team Workflow

GitHub Actions runs jobs automatically when something happens in your repo - for example, run the tests on every push and pull request. This is CI (Continuous Integration).

GitHub Actions runs tasks automatically when something happens in your repository - run tests on every push, check pull requests, or deploy when main changes. Automation catches mistakes early and saves repetitive manual work.

Example
# .github/workflows/test.yml
name: Tests
on:
  push:
    branches: [main]
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npm test

Every PR now shows a green tick or a red cross. Teams can block merging until the checks pass. The same idea can also deploy the site after a merge (CD - Continuous Delivery).

Keep secrets (API keys, deploy passwords) in Settings → Secrets and variables → Actions and read them as ${{ secrets.NAME }}. Never write them in the workflow file.

A simple team workflow (GitHub Flow)

  • main is always working and deployable.
  • Every task gets a short-lived branch from main.
  • Open a PR early; CI runs; a teammate reviews.
  • Merge when green and approved, then deploy.
  • Delete the branch.

Commit message style many teams use

Example
feat: add coupon field to checkout
fix: round GST to 2 decimals
docs: explain how to run tests
refactor: split cart service
test: cover empty cart total
Key points
  • Workflows live in .github/workflows/*.yml.
  • They run on events like push and pull_request.
  • Use them for tests, checks and deployment.

📝 Test yourself

1. Where do GitHub Actions workflow files live?
2. Where should a deploy password go?
3. Fill in the event that runs a workflow for every pull request:
on: