Ravindra BagaleCourses & study guides Track your progress

Guides

GitHub Actions: Your First CI Pipeline

Read this guide in: English · मराठी · हिंदी

Why do we need GitHub Actions? Because there is a real problem between developers and operations. Developers push code and say “I tested on my laptop.” Operations — the employee on the server side — discovers Friday night that nobody ran the shared checks. A first CI pipeline runs the same command on every push so both sides see pass/fail before anyone debates deploy.

Friends, CI means a computer checks your change the same way every time. First see the “forgot to test” fight.

Quick answer

Hold this vertical picture:

  1. Developer — pushes code to GitHub.
  2. Operations — server-side person who should only see builds that passed checks.
  3. The problem — “I tested locally” vs broken production; no shared log.
  4. GitHub Actions — YAML under .github/workflows/ runs on push.
  5. Pocket line: push → runner checks out code → steps must stay green.

Language: English · मराठी · हिंदी

Why do we need a first CI pipeline?

  1. Developers forget to run the same checks every time.
  2. Operations on the server side needs evidence before deploy.
  3. Without CI, every release trusts memory and chat.

Need a GitHub repo with at least README.md, plus Git basics.

What does operations have to do with Actions?

  1. Operations still owns production health.
  2. A green Actions run is a shared signal: “this commit was checked.”
  3. Secrets stay in GitHub Settings — never in the repo operations might copy later.

What is the problem? Suppose we are…

Suppose we are building Instagram (like updates)

Suppose a profile badge push skips tests. It looks fine on one laptop. Production breaks. Operations has no CI log — only blame.

Suppose we are working at Netflix and we are giving updates

Suppose Netflix-style teams push many times a day. Manual “please run tests” does not scale. Every push must trigger the same automated check.

Suppose you are working in Infosys on a client project

Suppose the client operations team asks: “Show the pipeline result before we deploy.” A green GitHub Actions run is that proof.

GitHub Actions CI pipeline on every push A git push starts a workflow from .yml: checkout the repo, run job steps on a runner, then report pass or fail. git push to main Workflow ci.yml on: push Job · runner 1. checkout 2. ls / test 3. report Result ✓ pass / fail CI proof before deploy Diagram of the YAML idea — no live GitHub login required to learn the shape

A git push starts a workflow from .yml: checkout on a runner, run steps, report pass or fail.

GitHub Actions YAML concept Teaching diagram of a first ci.yml workflow shape without requiring a live GitHub login.

Teaching diagram of a first GitHub Actions ci.yml shape — no live GitHub login required to learn the idea.

How GitHub Actions answers that same fight

Create .github/workflows/ci.yml:

name: ci
on:
  push:
    branches: [main]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Show repo files
        run: ls -la
      - name: Simple check
        run: test -f README.md

Then:

mkdir -p .github/workflows
# save ci.yml
git add .github/workflows/ci.yml
git commit -m "Add GitHub Actions CI workflow"
git push

Watch: GitHub → Actions → open the run → expand the build job.

Pieces:

Key Meaning in the story
on: push Start when code is pushed
jobs.build One job named build
runs-on GitHub-hosted runner
steps Ordered checks
actions/checkout Clones your repo onto the runner

Fail on purpose once (test -f DOES_NOT_EXIST), read the red log, then restore. Keep secrets in Settings → Secrets and variables → Actions.

Ravindra Bagale's Tip

Students paste five deploy jobs on day one. Start with checkout + one honest check. When that is green every push, add build or test steps. Lakshat theva.

Common errors — story pain then fix

Pain from the stories Likely cause Fix
Workflow never runs Wrong branch / file path File under .​github/​workflows/; match branches
YAML parse error Indentation Spaces carefully
checkout fails Auth / Actions disabled Enable Actions; re-push
Secret empty Typo in secret name Case-sensitive names
Quota messages Private repo minutes Check GitHub plan docs

Samajla ka? Why Actions = stop “I tested on laptop” vs server-side surprises; Instagram / Netflix / Infosys “suppose”; push starts the workflow. That is your first CI heartbeat.

Frequently asked questions

What is GitHub Actions?

GitHub’s built-in CI/CD: workflows run on GitHub-hosted (or self-hosted) runners when events happen.

What is a workflow?

A YAML file under .github/workflows that lists jobs and steps.

What is a runner?

The machine that executes your job (for example ubuntu-latest).

Is Actions free for public repos?

GitHub offers free minutes for public repositories; check current GitHub billing docs for private repos.

Do I need Docker in Actions on day one?

No. Start with checkout plus a simple shell or language setup action.

How do secrets work?

Store tokens in repo Settings → Secrets and reference them as ${{ secrets.NAME }} — never commit secrets.