📖 Guide

GitHub Actions — Complete Reference

Complete GitHub Actions cheat sheet — workflows, triggers, jobs, and CI/CD patterns.

76 commands across 10 categories

Workflow Basics

CommandDescription
.github/workflows/ci.yml
Workflow files live in .github/workflows/ directory
name: CI Pipeline
Set the workflow display name
on: push
Trigger workflow on push events
runs-on: ubuntu-latest
Specify the runner OS (ubuntu-latest, windows-latest, macos-latest)
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
Minimal workflow structure
concurrency: group: ci-main cancel-in-progress: true
Cancel redundant runs for the same group
permissions: contents: read packages: write
Set GITHUB_TOKEN permissions for the workflow

Triggers

CommandDescription
on: push: branches: [main, develop]
Trigger on push to specific branches
on: pull_request: types: [opened, synchronize]
Trigger on PR events
on: push: paths: - "src/**" - "!docs/**"
Trigger only when specific paths change (with exclusion)
on: schedule: - cron: "0 6 * * 1"
Scheduled trigger (every Monday at 06:00 UTC)
on: workflow_dispatch: inputs: environment: type: choice options: [staging, production]
Manual trigger with input parameters
on: release: types: [published]
Trigger on new release publication
on: workflow_call: inputs: node-version: type: string required: true
Make workflow reusable (callable from other workflows)
on: push: tags: - "v*"
Trigger on version tags

Jobs & Steps

CommandDescription
steps: - uses: actions/checkout@v4
Check out the repository code
- name: Install deps run: npm ci
Run a shell command
- name: Multi-line script run: | echo "Line 1" echo "Line 2"
Multi-line shell commands
needs: [build, lint]
Job dependency — wait for other jobs to finish
if: github.ref == 'refs/heads/main'
Conditional job/step execution
- name: Upload if: success() run: echo "Only on success"
Run step only if previous steps succeeded (also: failure(), always(), cancelled())
timeout-minutes: 15
Set timeout for a job
continue-on-error: true
Allow a step to fail without failing the job
working-directory: ./frontend
Set working directory for a step's run commands
services: postgres: image: postgres:15 ports: - 5432:5432
Run service containers alongside the job

Environment Variables

CommandDescription
env: NODE_ENV: production
Set env vars at workflow, job, or step level
GITHUB_SHA
Built-in: the commit SHA that triggered the workflow
GITHUB_REF
Built-in: the branch or tag ref (e.g. refs/heads/main)
GITHUB_REPOSITORY
Built-in: owner/repo name
GITHUB_ACTOR
Built-in: username that triggered the workflow
GITHUB_RUN_NUMBER
Built-in: sequential number for each workflow run
echo "MY_VAR=value" >> "$GITHUB_ENV"
Set environment variable for subsequent steps
echo "result=success" >> "$GITHUB_OUTPUT"
Set step output for use in other steps

Secrets

CommandDescription
secrets.GITHUB_TOKEN
Auto-generated token with repo permissions
secrets.MY_SECRET
Access a repository or organization secret
env: API_KEY: ${{ secrets.API_KEY }}
e.g. Use single quotes around the expression in YAML
Pass secret as environment variable
vars.MY_VARIABLE
Access a repository configuration variable (non-secret)
environment: production
Use environment-specific secrets by specifying an environment
secrets.inherit
e.g. jobs: call: uses: ./.github/workflows/reusable.yml secrets: inherit
Pass all secrets to a called reusable workflow

Matrix Strategy

CommandDescription
strategy: matrix: node-version: [18, 20, 22]
Run job across multiple configurations
- uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }}
Use matrix value in a step
strategy: matrix: os: [ubuntu-latest, windows-latest] node: [18, 20]
e.g. runs-on: ${{ matrix.os }}
Multi-dimensional matrix (creates all combinations)
include: - os: ubuntu-latest node: 22 experimental: true
Add specific combinations to the matrix
exclude: - os: windows-latest node: 18
Exclude specific combinations from the matrix
strategy: fail-fast: false
Continue other matrix jobs even if one fails
strategy: max-parallel: 2
Limit concurrent matrix jobs

Caching

CommandDescription
- uses: actions/cache@v4 with: path: ~/.npm key: npm-${{ hashFiles('**/package-lock.json') }}
Cache npm dependencies
restore-keys: | npm-${{ runner.os }}-
Fallback cache keys when exact match not found
- uses: actions/setup-node@v4 with: node-version: 20 cache: npm
Built-in caching with setup-node (simplest)
- uses: actions/cache@v4 with: path: | ~/.cache/pip ~/.local key: pip-${{ hashFiles('**/requirements.txt') }}
Cache multiple directories
- uses: actions/cache/restore@v4 with: path: ./dist key: build-${{ github.sha }}
Restore cache without saving (read-only)
- uses: actions/cache/save@v4 if: always() with: path: ./dist key: build-${{ github.sha }}
Save cache even if job fails

Artifacts

CommandDescription
- uses: actions/upload-artifact@v4 with: name: build-output path: dist/
Upload build artifacts
- uses: actions/download-artifact@v4 with: name: build-output
Download artifacts in a later job
retention-days: 5
Set artifact retention period
if-no-files-found: error
Fail if no files match the path (warn, ignore, error)
path: | dist/ coverage/ !dist/**/*.map
Upload multiple paths with exclusions
- uses: actions/download-artifact@v4 with: name: build-output path: ./downloaded
Download artifact to a specific directory

Common Actions

CommandDescription
uses: actions/checkout@v4
Check out repository (most used action)
uses: actions/setup-node@v4 with: node-version: 20
Set up Node.js environment
uses: actions/setup-python@v5 with: python-version: "3.12"
Set up Python environment
uses: docker/build-push-action@v5 with: push: true tags: user/app:latest
Build and push Docker image
uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }}
Log in to container registry
uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist
Deploy to GitHub Pages
uses: softprops/action-gh-release@v1 with: files: dist/*.zip
Create GitHub Release with assets
uses: actions/github-script@v7 with: script: | github.rest.issues.createComment({ ... })
Run JavaScript with GitHub API access

Expressions & Contexts

CommandDescription
github.event_name
The event that triggered the workflow (push, pull_request, etc.)
github.event.pull_request.number
PR number from the event payload
runner.os
The OS of the runner (Linux, Windows, macOS)
steps.step_id.outputs.result
Access output from a previous step by its id
needs.job_id.outputs.my_output
Access output from a dependent job
contains(github.event.head_commit.message, '[skip ci]')
Check if commit message contains a string
startsWith(github.ref, 'refs/tags/v')
Check if ref starts with a value
toJSON(github.event)
Convert context to JSON string (useful for debugging)
hashFiles('**/package-lock.json')
Generate hash of files (used for cache keys)
format('Hello {0}, from {1}!', 'world', 'GHA')
String formatting function

More Guides

🌿
Git Commands
Complete Git command reference — from basics to advanced workflows. Searchable, with examples.
📝
Vim Commands
Complete Vim/Vi command reference — modes, motions, editing, search, and advanced features.
🐳
Docker Commands
Complete Docker & Docker Compose command reference — containers, images, volumes, networks, and orchestration.
🔤
Regex Reference
Complete regular expression reference — syntax, patterns, quantifiers, groups, lookaheads, and common recipes.
🐧
Linux Commands
Complete Linux/Bash command reference — file management, text processing, networking, system admin, and shell scripting.
☸️
Kubernetes Commands
Complete Kubernetes & kubectl command reference — pods, deployments, services, configmaps, and cluster management.
🐍
Python Reference
Complete Python reference — syntax, data structures, string methods, file I/O, comprehensions, and common patterns.
🗃️
SQL Reference
Complete SQL reference — queries, joins, aggregation, subqueries, indexes, and database management.
🌐
Nginx Reference
Complete Nginx configuration reference — server blocks, locations, proxying, SSL, load balancing, and caching.
🔐
SSH Commands
Complete SSH reference — connections, key management, tunneling, config, SCP/SFTP, and security hardening.
👷
Jenkins Reference
Complete Jenkins reference — pipeline syntax, Jenkinsfile, plugins, CLI, agents, and CI/CD patterns.
📨
HTTP Headers Reference
Complete HTTP headers reference — request headers, response headers, caching, security, CORS, and content negotiation. Searchable, with examples.
🐘
PostgreSQL Reference
Comprehensive PostgreSQL reference — from connection basics to advanced features like JSONB, full-text search, window functions, and performance tuning.
Async Patterns Reference
Multi-language async/concurrency patterns — JavaScript, Python, Go, Rust, Java, and universal concurrency patterns.
📡
Protobuf & gRPC Reference
Comprehensive reference for Protocol Buffers (proto3) and gRPC — message definitions, services, streaming, and common patterns.
📚
JS Array Methods
Complete JavaScript Array methods reference — creating, searching, transforming, sorting, iterating, and common patterns. Searchable, with examples.
🌊
Tailwind CSS Reference
Complete Tailwind CSS reference — layout, spacing, typography, colors, responsive design, states, and common patterns. Searchable, with examples.
GraphQL Reference
Complete GraphQL reference — schema definition, types, queries, mutations, directives, fragments, and common patterns. Searchable, with examples.
💻
VS Code Shortcuts
Complete VS Code keyboard shortcuts — editing, navigation, search, multi-cursor, terminal, debug, and more. Searchable, with Cmd/Ctrl notation.
🔲
CSS Grid Reference
Complete CSS Grid reference — container properties, item placement, grid functions, and common layout patterns. Searchable, with examples.
📦
CSS Flexbox Reference
Complete CSS Flexbox reference — container properties, item properties, and common layout patterns. Searchable, with examples.
⚛️
React Hooks Reference
Complete React Hooks reference — useState, useEffect, useContext, custom hooks, and common patterns. Searchable, with examples.
🔷
TypeScript Reference
Complete TypeScript reference — types, interfaces, generics, utility types, and advanced patterns. Searchable, with examples.
☁️
AWS CLI Reference
Complete AWS CLI reference — EC2, S3, IAM, Lambda, ECS, RDS, CloudFormation, and common operations.
🐹
Go Reference
Complete Go (Golang) reference — syntax, types, functions, concurrency, error handling, and common patterns.
💠
PowerShell Reference
Complete PowerShell reference — cmdlets, pipelines, scripting, file operations, remote management, and Active Directory.
💾
Redis Commands
Complete Redis command reference — strings, hashes, lists, sets, sorted sets, pub/sub, transactions, and server management.
🏗️
Terraform Commands
Complete Terraform reference — init, plan, apply, state management, modules, workspaces, and HCL syntax.
⚙️
Ansible Commands
Complete Ansible reference — playbooks, modules, inventory, roles, vault, and ad-hoc commands.
🟨
JavaScript
Complete JavaScript reference — variables, types, operators, strings, arrays, objects, functions, async, DOM, ES6+, and more.
🎨
CSS
Complete CSS reference — selectors, box model, positioning, typography, animations, media queries, custom properties, and more.
📄
HTML
Complete HTML reference — document structure, text content, forms, media, semantic elements, accessibility, and more.
Java
Complete Java reference — data types, strings, collections, OOP, interfaces, exceptions, file I/O, streams, lambdas, and more.
💻
Bash
Complete Bash reference — variables, strings, arrays, conditionals, loops, functions, file tests, I/O redirection, process management, and more.
🦀
Rust
Comprehensive Rust language cheat sheet covering ownership, traits, pattern matching, concurrency, and more.
📝
Markdown
Complete Markdown syntax reference for headings, formatting, links, tables, code blocks, and extensions.
📋
YAML
YAML syntax reference covering scalars, collections, anchors, multi-line strings, and common patterns.
🌐
Curl
Curl command-line reference for HTTP requests, authentication, file transfers, debugging, and common API patterns.
Cron
Cron scheduling reference covering syntax, field values, crontab management, and common schedule patterns.
🖥️
Tmux
Terminal multiplexer for managing multiple sessions, windows, and panes from a single terminal.
🔧
Awk
Powerful text processing language for pattern scanning, data extraction, and report generation.
✂️
Sed
Stream editor for filtering and transforming text, line by line.
🔍
Find
Search for files and directories in a directory hierarchy with powerful filtering options.
🔎
Grep
Search text using patterns. Filter lines from files, command output, or streams with regular expressions.
🐘
PHP
Complete PHP cheat sheet covering syntax, OOP, arrays, PDO, and modern PHP 8.x features.
⚙️
C
Complete C programming cheat sheet covering syntax, pointers, memory management, and standard library.
🔷
C++
Complete C++ cheat sheet covering STL containers, OOP, templates, smart pointers, and modern C++ features.
🐬
MySQL
Complete MySQL cheat sheet covering queries, joins, indexes, transactions, and administration.
💅
Sass
Complete Sass/SCSS cheat sheet covering variables, mixins, functions, nesting, and modern module system.
🔐
Chmod
Linux file permission commands and patterns for chmod.
🔢
NumPy
Essential NumPy commands for array manipulation and numerical computing in Python.
🐼
Pandas
Pandas cheat sheet for data manipulation, analysis, and transformation in Python.
🎯
Dart
Dart language cheat sheet covering syntax, types, OOP, null safety, and async patterns.
🔺
Laravel
Laravel PHP framework cheat sheet for routing, Eloquent, Blade, Artisan, and more.
🟩
Node.js
Comprehensive Node.js runtime reference covering modules, file system, HTTP, streams, and more.
Next.js
Next.js App Router reference covering routing, data fetching, server components, and deployment.
🍃
MongoDB
MongoDB reference covering CRUD operations, aggregation, indexes, and administration.
🔥
Firebase
Firebase reference covering Authentication, Firestore, Realtime Database, Cloud Functions, and Hosting.
🐳
Docker Compose
Docker Compose reference covering CLI commands, service configuration, networking, volumes, and more.
💲
jQuery
Quick reference for jQuery selectors, DOM manipulation, events, AJAX, and more.
📐
LaTeX
Quick reference for LaTeX document structure, math mode, formatting, and common packages.
🎯
XPath
Quick reference for XPath expressions, axes, predicates, and functions for XML/HTML querying.
Emmet
Quick reference for Emmet abbreviations for lightning-fast HTML and CSS coding.
📦
TOML
Quick reference for TOML configuration file syntax, types, tables, and common patterns.
💎
Prisma
Complete Prisma ORM cheat sheet — schema, queries, migrations, and CLI.
📦
npm
Complete npm cheat sheet — package management, scripts, publishing, and configuration.
Supabase
Complete Supabase cheat sheet — auth, database, realtime, storage, and edge functions.
🪶
Apache
Complete Apache HTTP Server cheat sheet — virtual hosts, modules, rewrite rules, and SSL.
📡
HTTP Status Codes
Complete reference of all standard HTTP response status codes with descriptions and use cases.
🔤
ASCII Table
Complete ASCII character reference with decimal, hexadecimal, and character values.
🔧
Chrome DevTools
Essential Chrome DevTools shortcuts, commands, and workflows for web developers.
💧
Drizzle ORM
Complete Drizzle ORM reference for schema definition, queries, relations, migrations, and common patterns.
Vercel CLI
Complete Vercel CLI reference for deployment, project management, domains, environment variables, and configuration.
🔄
PM2
Production process manager for Node.js applications with built-in load balancer, monitoring, and zero-downtime reloads.
📺
Screen
GNU Screen terminal multiplexer for persistent sessions, window management, and remote work.
📦
Webpack
Module bundler for JavaScript applications — loaders, plugins, code splitting, optimization, and dev server.
Vite
Next-generation frontend build tool with instant HMR, native ES modules, and optimized production builds via Rollup.

📖 Free, searchable command reference. Bookmark this page for quick access.