bg_image
header

GitHub Actions

🛠️ What is GitHub Actions?

GitHub Actions is a feature of GitHub that lets you create automated workflows for your software projects—right inside your GitHub repository.


📌 What can you do with GitHub Actions?

You can build CI/CD pipelines (Continuous Integration / Continuous Deployment), such as:

  • ✅ Automatically test code (e.g. with PHPUnit, Jest, Pytest)

  • 🛠️ Build your app on every push or pull request

  • 🚀 Automatically deploy (e.g. to a server, cloud platform, or DockerHub)

  • 📦 Create releases (e.g. zip packages or version tags)

  • 🔄 Run scheduled tasks (cronjobs)


🧱 How does it work?

GitHub Actions uses workflows, defined in a YAML file inside your repository:

  • Typically stored as .github/workflows/ci.yml

  • You define events (like push, pull_request) and jobs (like build, test)

  • Each job consists of steps, which are shell commands or prebuilt actions

Example: Simple CI Workflow for Node.js

name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '20'
      - run: npm install
      - run: npm test

🧩 What are "Actions"?

An Action is a single reusable step in a workflow. You can use:

  • Prebuilt actions (e.g. actions/checkout, setup-node, upload-artifact)

  • Custom actions (e.g. shell scripts or Docker-based logic)

You can explore reusable actions in the GitHub Marketplace.


💡 Why use GitHub Actions?

  • Saves time by automating repetitive tasks

  • Improves code quality through automated testing

  • Enables consistent, repeatable deployments

  • Integrated directly in GitHub—no need for external CI tools like Jenkins or Travis CI