Introduction to GitHub Actions
GitHub Actions, workflow, job, step, runner, YAML syntax, workflow file location, events
Introduction to GitHub Actions
GitHub Actions is a CI/CD and automation platform built directly into GitHub. It allows you to automate your build, test, and deployment pipeline by writing workflows in YAML files stored in your repository. When events like push, pull request, or a scheduled timer occur, GitHub automatically runs the workflows you define.
Core Concepts
A workflow is an automated process defined in a YAML file. Workflows live in the .github/workflows/ directory of your repository. Each workflow contains one or more jobs. A job is a group of steps that runs on the same machine (called a runner). Steps are individual tasks within a job — they can run shell commands or use pre-built actions from the GitHub Marketplace.
A Simple Workflow
name: Hello World
on: [push]
jobs:
greet:
runs-on: ubuntu-latest
steps:
- name: Print hello
run: echo "Hello, GitHub Actions!"This workflow runs on every push to any branch. The job runs on a fresh Ubuntu virtual machine and executes a single shell command.
Trigger Events
Workflows are triggered by events. Common events include push, pull_request, schedule (cron), workflow_dispatch (manual trigger), and release. You can filter events by branch, tag, or file path changes.
