GitHub Actions and Pipelines

Site Admin · 11 Sep 2026 · 8 views

GitHub Actions and Pipelines

Pipelines as Code

GitHub Actions runs your CI/CD pipeline directly from your repository. The pipeline lives in a YAML file inside .github/workflows, so version control tracks every pipeline change, reviews them like code, and documentation lives next to the project.

The Anatomy of a Workflow

name: CI
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - run: pip install -r requirements.txt
      - run: pytest

The on key declares the trigger; here every push and pull request runs the workflow. Each job defines an environment with runs-on. Steps run in order, and the checkout action fetches the repository code into the runner.

Events, Jobs, and Steps

Events tell the workflow when to run: push, pull_request, schedule, or workflow_dispatch (manual trigger). Jobs run in parallel by default, and steps inside a job run sequentially, sharing the same workspace and failing the job on the first error.

A test job and a deploy job may be wired together with the needs key, so deployment waits until tests pass. This is how CI naturally flows into CD inside one file.

Secrets and Environments

Never put credentials in the YAML file. Store them as GitHub secrets under repository settings and reference them with the secrets context. Deployment stages can also link to environments with protection rules and approval gates.

- run: deploy.sh
  env:
    API_TOKEN: ${{ secrets.API_TOKEN }}

Build Your First Workflow

Start small: a workflow that runs your test suite on every push. Make it fail, fix it, and watch it run on the Actions tab. That loop is the fundamental CI experience and the foundation you build on later.

Key Points

  • GitHub Actions defines pipelines as YAML in .github/workflows.
  • on declares triggers; jobs run in parallel; steps run in sequence.
  • actions/checkout fetches the repository, and setup-python installs a runtime.
  • Secrets hide credentials; environments add approval gates.
  • Start with a test-on-push workflow and extend it from there.
Share this post:

Comments (0)

Please login or register to comment.