What is GitHub Actions? A Beginner-Friendly Guide with Examples



This content originally appeared on DEV Community and was authored by ak0047

Introduction

When I was researching how to automate the deployment of a React app, I discovered that it can be done using GitHub Actions.

But then I thought:
“What exactly is GitHub Actions?”
So I dug into it, and here’s a summary of what I learned.

What is GitHub Actions?

GitHub Actions is a CI/CD platform provided by GitHub.
It allows you to define workflows that run automatically in response to events in your GitHub repository—such as pushes, pull requests, or scheduled jobs.

GitHub also provides the virtual machines (runners) where your workflows execute, so you don’t need to manage servers yourself.

What Can You Do with GitHub Actions?

GitHub Actions is not just for deployment automation—it can cover the whole development lifecycle.

  1. Automated Testing (CI)

    • Automatically run tests whenever you push or open a pull request.
    • Catch bugs early before merging.
  2. Code Quality Checks

    • Run linters and formatters automatically.
    • Enforce consistent coding style across the team.
  3. Security Checks

    • Automate vulnerability scans (npm audit, pip-audit, etc.).
    • Combine with Dependabot for automatic dependency updates.
  4. Deployment Automation (CD)

    • Deploy automatically to AWS, Vercel, Netlify, or S3 + CloudFront whenever changes are merged into main.
    • No more manual uploads.
  5. Scheduled Jobs

    • Like cron jobs: run tasks daily, weekly, or on any schedule.
    • Example: data collection, report generation, backups.
  6. Notifications

    • Send results to Slack, Discord, LINE, Teams, email, or any webhook.
    • Get alerted immediately when something fails.
  7. Issue / PR Management

    • Automatically label pull requests.
    • Close inactive issues automatically.

Notifications

GitHub Actions supports more than just GitHub’s built-in notifications. You can integrate with:

  • GitHub default notifications (UI + email)
  • Slack
  • Discord
  • LINE
  • Teams / Google Chat
  • Email (SMTP)
  • Custom Webhooks (send data to your own service)

Writing a Workflow (YAML)

Workflows in GitHub Actions are defined in YAML files inside the .github/workflows/ directory.

Here’s a minimal example:

name: My First Workflow

on:            # Trigger: when to run
  push:         # Run when code is pushed
  pull_request: # Run when PR is opened

jobs:           # Define jobs
  build:
    runs-on: ubuntu-latest   # Runner environment
    steps:
      - name: Run a command
        run: echo "Hello, world!"
      - uses: actions/checkout@v4   # Use an existing action

What Does uses: Mean?

The uses: keyword is for reusing existing GitHub Actions (action).
An “action” is a small automation script published on GitHub (either official or community-made).

You can find thousands of actions in the GitHub Marketplace.

Commonly Used Actions

- uses: actions/checkout@v4   # Checkout repository code into the runner
- uses: actions/setup-node@v4 # Setup a Node.js environment

Using actions lets you add common functionality without reinventing the wheel.

Tip: If an action has multiple versions (e.g., @v4, @v5), it’s usually best to stick to the latest LTS or stable version unless your project requires otherwise.

Free Usage Limits

GitHub Actions is free to use, but there are some limits depending on your plan.

  • Public Repositories
    • Unlimited usage for free.
    • Perfect for open-source projects.
  • Private Repositories
    • 2,000 minutes per month of runtime for free.
    • 500 MB of storage included.

For most hobby projects or small teams, the free tier is more than enough.

Trying It Out

To understand how it works, I created a simple workflow that just prints a message whenever I push or open a PR.

Steps:

  1. Create a new empty repository.
  2. Inside it, create a .github/workflows/ directory.
  3. Add the following YAML file:
# .github/workflows/hello.yml
name: Hello GitHub Actions

on:
  push:
  pull_request:

jobs:
  say-hello:
    runs-on: ubuntu-latest
    steps:
      - name: Say Hello
        run: echo "Hello from GitHub Actions!"

Then, push this repo to GitHub.
You can see the workflow run under the Actions tab in your repository.

actions_run_image

Example repo: actions-tutorial

Conclusion

GitHub Actions is a powerful CI/CD platform built right into GitHub.
It can automate much more than just deployment:

  • Testing
  • Code quality checks
  • Security scans
  • Scheduled jobs
  • Notifications
  • Issue/PR management

In other words, it can automate your entire development workflow.

If you have creative or unusual use cases for GitHub Actions, I’d love to hear them!

References


This content originally appeared on DEV Community and was authored by ak0047