Understanding how to organize and run your automation tasks
Think of a job as a unit of work - like a single task on your to-do list that needs to be completed. In GitHub Actions, jobs are the main building blocks that actually DO the work.
Simple analogy: If your workflow is like a construction project, then jobs are like different work crews (plumbing crew, electrical crew, painting crew) that each handle specific tasks.
name: My Workflow
on: [push]
jobs: # This is where all the actual work is defined
build: # Job 1: Build the application
# job details...
test: # Job 2: Run tests
# job details...
deploy: # Job 3: Deploy to production
# job details...
Every job has the same basic structure:
jobs:
job_name: # 1. Job ID (you choose this name)
runs-on: ubuntu-latest # 2. What computer to run on
steps: # 3. List of tasks to do
- name: Step 1
run: echo "Hello"
- name: Step 2
run: echo "World"
Let's break down each part:
job_name)build, run-tests, deploy_prod, lint-codejobs:
build-app: # ✅ Good job name
run_tests: # ✅ Good job name
Deploy-Production: # ❌ Bad (uppercase)
runs-on)ubuntu-latest - Linux computer (most common)windows-latest - Windows computermacos-latest - Mac computerjobs:
my-job:
runs-on: ubuntu-latest# Fresh Linux computer for this job