46 SECTIONS · 1288 TOPICS
Github Actions Roadmap
Understanding GitHub Actions Core Concepts
- 1. Understanding Workflows
- Example: Basic Workflow Configuration
- 2. Understanding Jobs
- Example: Basic Job Definition
- 3. Understanding Steps
- Example: Using a built-in action
- Example: Using a custom action with inputs
- 4. Understanding Actions
- Example: Using a GitHub Action
- Action Types
- 5. Understanding Runners
- Example: Self-hosted runner registration
- 6. Understanding Events
- Example: Push Event Configuration
- Example: Scheduled Workflow
- 7. Understanding Contexts
- Example: Using GitHub Context in a Workflow
- Key Points About Contexts
- 8. Understanding YAML Syntax
- Example: Basic Workflow Structure
- 9. Understanding Workflow Execution Model
- Example: Basic Workflow Execution Flow
- Execution Lifecycle
- 10. Understanding Billing and Quotas
- Example: Billing Alert
- Key Billing Points
Setting Up Workflow Files
- 1. Creating Workflow File
- Example: Basic workflow file structure
- 2. Naming Workflows
- Example: Setting Workflow Name
- 3. Defining Workflow Syntax
- Example: Basic Workflow Syntax
- 4. Using Workflow Templates
- Example: Using a GitHub-provided workflow template
- How to Use Templates
- 5. Organizing Multiple Workflows
- Workflow Organization Strategy
- Example: Workflow File Organization
- 6. Validating Workflow Syntax
- Example: Basic workflow syntax validation
- 7. Setting Workflow Defaults
- Example: Setting Default Shell and Working Directory
- 8. Disabling Workflows
- Example: Disabling Workflow via Configuration
- 9. Versioning Workflows
- Example: Using v3 in workflow file
- 10. Inheriting Workflow Settings
- Example: Reusing a Workflow
- Example: Inheriting from Reusable Workflow
Working with Workflow Triggers
- 1. Triggering on Push Events
- Example: Basic Push Trigger
- Example: Push with Path Filtering
- Example: Push with Tag Filtering
- 2. Triggering on Pull Requests
- Example: Trigger on pull request
- Key Points
- 3. Triggering Manually
- Example: Manual Trigger with Inputs
- 4. Triggering on Schedule
- Example: Schedule Trigger
- Schedule Trigger Details
- 5. Triggering on Issues
- Example: Automatically assign issues to a team member
- Example: Comment on issue when labeled
- 6. Triggering on Releases
- Example: Release Trigger Configuration
- 7. Triggering on Repository Events
- Example: Triggering on Push to Main Branch
- Example: Triggering on Pull Request
- 8. Triggering on Forks
- Example: Using
- 9. Using Activity Types
- Example: Using
- Example: Using
- Example: Using
- 10. Combining Multiple Triggers
- Example: Combining push and pull_request triggers
- Example: Using schedule and workflow_dispatch together
- 11. Filtering by Branches and Tags
- Example: Filtering by Branches
- Example: Filtering by Tags
- 12. Using Webhook Events
- Example: Using push event
- Example: Using pull_request event
Working with Path Filtering
- 1. Filtering by Changed Paths
- Example: Using path filters in a workflow
- 2. Ignoring Paths
- Example: Using paths-ignore
- 3. Using Glob Patterns
- Example: Filtering by file extension
- Example: Excluding directories
- 4. Filtering Documentation Changes
- Example: Using Path Filters in a Workflow
- 5. Filtering Source Code
- Example: Using path filters in a workflow
- 6. Filtering by File Extensions
- Example: Using file extension filtering in a workflow
- 7. Using Negation Patterns
- Example: Exclude JavaScript files in src directory
- 8. Combining Path and Branch Filters
- Example: Combining Path and Branch Filters
- 9. Detecting Modified Files
- Example: Check if a file was modified
- 10. Running Conditional Steps
- Example: Using
- Example: Complex condition with
- 11. Using Path Filters with Matrix
- Example: Path Filtered Matrix Job
- 12. Optimizing CI with Path Filters
- Example: Using path filters to optimize CI
- Best Practices for Path Filters
Configuring Jobs
- 1. Defining Jobs
- Example: Basic job definition
- 2. Naming Jobs
- Example: Setting a Job Name
- 3. Setting Job Dependencies
- Example: Basic Job Dependencies
- Example: Multiple Job Dependencies
- 4. Running Jobs Conditionally
- Example: Conditional Job Execution
- Example: Matrix Strategy
- 5. Specifying Runner Type
- Example: Using Ubuntu 22.04 runner
- 6. Configuring Job Timeout
- Example: Setting Job Timeout
- 7. Setting Job Strategy
- Example: Matrix Strategy
- 8. Setting Job Outputs
- Example: Setting a Job Output
- 9. Configuring Job Environment
- Example: Setting Environment Variables
- Example: Setting Default Shell
- 10. Using Job Containers
- Example: Using a PostgreSQL container
- 11. Configuring Service Containers
- Example: Using a PostgreSQL Service Container
- 12. Setting Job Concurrency
- Example: Setting concurrency with a string
- Example: Setting concurrency with an object
Working with Steps
- 1. Defining Steps
- 2. Naming Steps
- Example: Naming Steps
- 3. Running Shell Commands
- Example: Running Shell Commands
- 4. Using Actions
- 5. Setting Step Conditions
- 6. Setting Step Timeout
- Example: Setting Step Timeout
- 7. Setting Step Shell
- 8. Setting Working Directory
- Example: Setting Working Directory
- 9. Configuring Step Environment Variables
- Example: Setting Environment Variables
- 10. Handling Step Failures
- 11. Using Step Outputs
- Example: Using Step Outputs
- 12. Running Steps in Containers
- Example: Running Steps in Containers
Configuring GitHub-Hosted Runners
- 1. Using GitHub-Hosted Runners
- Example: Using ubuntu-latest runner
- 2. Specifying Runner OS
- Example: Setting OS for workflow
- 3. Using Latest Runner Images
- Example: Using Latest Ubuntu Runner
- Example: Using Ubuntu 24.04 Runner
- 4. Using Specific Runner Versions
- Example: Specifying runner version in workflow
- 5. Running on Multiple OS
- Example: Matrix Strategy for Multiple OS
- 6. Using Larger Runners
- Example: Using larger runner in workflow
- 7. Using Runner Context
- Example: Using runner context in a job
- 8. Checking Runner Capabilities
- Example: Using runner capabilities in a workflow
- 9. Using Pre-installed Tools
- Example: Using pre-installed Node.js in a workflow
- 10. Accessing Runner Workspace
- Example: Using Workspace in a Job
Managing Self-Hosted Runners
- 1. Installing Runner Application
- Example: Install GitHub Actions Runner on Linux
- 2. Configuring Runner
- Example: Runner Configuration File
- 3. Running as Service
- Example: systemd service configuration
- Service Management Commands
- 4. Using Runner Labels
- Example: Assigning Labels to Runners
- 5. Setting Up Runner Groups
- Example: Create a Runner Group
- Example: Add a Runner to a Group
- Runner Group Management
- 6. Configuring Proxy
- Example: Setting proxy in runner configuration
- 7. Using Ephemeral Runners
- Example: Configuring Ephemeral Runner
- 8. Setting Runner Work Directory
- Example: Configuring Work Directory
- 9. Managing Runner Updates
- Example: Update Runner
- 10. Removing Runners
- Example: Remove a Self-Hosted Runner via API
- 11. Monitoring Runner Status
- Example: Check runner status via API
- Workflow: Monitor runner health
- 12. Cleaning Up After Jobs
- Example: Using cleanup scripts in workflow
Using Built-in Actions
- 1. Checking Out Code
- Example: Basic checkout
- Example: Checkout specific branch
- Example: Checkout with custom path
- 2. Setting Up Node.js
- Example: Setting up Node.js with caching
- 3. Setting Up Python
- Example: Setting up Python with pip caching
- 4. Setting Up Java
- Example: Setting up Java 17 with Maven caching
- 5. Setting Up Go
- Example: Setting up Go in a workflow
- 6. Setting Up .NET
- Example: Setting up .NET Core 8.0
- 7. Setting Up Ruby
- Example: Setting up Ruby with Bundler caching
- 8. Caching Dependencies
- Example: Caching npm dependencies
- Example: Caching Gradle dependencies
- 9. Uploading Artifacts
- Example: Upload a build artifact
- 10. Downloading Artifacts
- Example: Downloading a Single Artifact
- Example: Download All Artifacts
- 11. Using GitHub Script
- Example: Basic Script Usage
- Example: Using Context Variables
- 12. Setting Up Docker Buildx
- Example: Setting up Docker Buildx
Working with Expressions and Contexts
- 1. Evaluating Expressions
- Example: Using Expressions in Conditions
- Example: Combining Expressions
- 2. Using GitHub Context
- Example: Accessing GitHub Context in a Job
- 3. Using Env Context
- Example: Setting and Using Environment Variables
- 4. Using Job Context
- Example: Using job context in a condition
- 5. Using Steps Context
- Example: Accessing Step Outputs
- 6. Using Runner Context
- Example: Using runner context in a job
- 7. Using Secrets Context
- Example: Using a Secret in a Workflow
- 8. Using Strategy Context
- Example: Using strategy.fail-fast
- Example: Using strategy.max-parallel
- Example: Using strategy.matrix
- 9. Using Needs Context
- Example: Accessing outputs from a previous job
- 10. Using Inputs Context
- Example: Accessing input value
- 11. Using Boolean Expressions
- Example: Using Boolean Expressions in Conditions
- 12. Using Comparison Operators
- Example: Using
- Example: Using
Working with Expression Functions
- 1. Using contains() Function
- 2. Using startsWith() Function
- Example: Using startsWith() in a GitHub Actions Workflow
- 3. Using endsWith() Function
- Example: Using endsWith() in a Condition
- 4. Using format() Function
- Example: Using format() in a GitHub Action
- 5. Using join() Function
- Example: Joining Array Elements
- Example: Joining with Custom Separator
- 6. Using toJSON() Function
- Example: Converting Object to JSON String
- 7. Using fromJSON() Function
- Example: Parsing JSON String
- 8. Using hashFiles() Function
- Example: Caching Dependencies Based on Lock File Changes
- 9. Using success() Function
- Example: Using success() in a conditional
- 10. Using failure() Function
- Example: Using failure() in a conditional
- 11. Using always() Function
- Example: Using always() in a job
- 12. Using cancelled() Function
- Example: Using cancelled() in a conditional
Working with Conditional Execution
- 1. Using If Conditions
- Example: Conditional Step Based on Event
- Example: Conditional Step Based on Branch
- Common If Conditions
- 2. Checking Job Status
- Example: Using
- 3. Checking Step Status
- Example: Using step outcome in a conditional
- 4. Using Always Condition
- Example: Using always() condition
- 5. Using Cancelled Condition
- Example: Cancelled Condition in a Job
- 6. Combining Conditions
- Example: Combining Conditions in a Job
- Example: Combining Conditions in a Step
- 7. Checking Event Type
- Example: Using event type in conditions
- 8. Checking Branch
- Example: Check if on main branch
- Example: Check if on feature branch
- 9. Checking Actor
- Example: Using
- 10. Using Ternary Expressions
- Example: Setting Job Matrix Based on Event
- Example: Conditional Environment Variable
- 11. Handling Default Values
- Example: Setting Default Values in Workflow
- 12. Using Environment Conditions
- Example: Environment Condition in a Job
- Example: Using Environment Variables in Conditions
Managing Secrets and Variables
- 1. Creating Repository Secrets
- Example: Creating a Repository Secret via GitHub UI
- 2. Creating Organization Secrets
- Example: Creating an Organization Secret via API
- 3. Creating Environment Secrets
- Example: Creating an Environment Secret via GitHub UI
- Example: Creating an Environment Secret via API
- 4. Using Secrets in Workflows
- Example: Using a secret in a job
- 5. Creating Variables
- Example: Setting a Repository Variable
- Key Points
- 6. Using Environment Variables
- Example: Setting an environment variable in a job
- Example: Using environment variable in a step
- 7. Setting Default Environment Variables
- Example: Using Default Environment Variables in a Job
- 8. Masking Secret Values
- Example: Setting a Secret
- 9. Using Encrypted Secrets
- Example: Using Encrypted Secrets in Workflow
- 10. Accessing Secrets in Actions
- Example: Using a Secret in a Job
- 11. Managing Secret Scope
- Example: Using Repository Secret in Workflow
- 12. Rotating Secrets
- Example: Rotating a Secret in GitHub Actions
Implementing Matrix Strategies
- 1. Defining Matrix Strategy
- Example: Basic Matrix Strategy
- Example: Matrix Strategy with Include
- 2. Using Matrix Variables
- Example: Using Matrix Variables in a Workflow
- 3. Including Matrix Combinations
- Example: Matrix with Include
- 4. Excluding Matrix Combinations
- Example: Using exclude to filter matrix combinations
- 5. Setting Fail-Fast Behavior
- Example: Configuring fail-fast in a matrix job
- 6. Setting Max Parallel Jobs
- Example: Configuring max-parallel
- 7. Using Dynamic Matrix
- Example: Dynamic matrix with environment variables
- Example: Using
- Example: Using
- 8. Accessing Matrix Values
- Example: Using matrix values in a job
- 9. Naming Matrix Jobs
- Example: Naming Matrix Jobs
- 10. Combining Multiple Matrices
- Example: Combining Multiple Matrices
- 11. Using Matrix with Outputs
- Example: Matrix with Outputs
- 12. Testing Across OS and Versions
- Example: Matrix Strategy for OS and Node.js Versions
Implementing Caching Strategies
- 1. Caching Dependencies
- Example: Caching Node.js Dependencies
- Example: Caching Multiple Paths
- 2. Defining Cache Keys
- Example: Defining Cache Keys
- 3. Using Restore Keys
- Example: Using restore-keys in a job
- 4. Caching Node Modules
- Example: Caching Node Modules
- 5. Caching Python Packages
- Example: Caching Python Dependencies
- 6. Caching Maven Dependencies
- Example: Caching Maven Dependencies
- 7. Caching Gradle Dependencies
- Example: Caching Gradle Dependencies
- 8. Caching Go Modules
- Example: Caching Go Modules in GitHub Actions
- 9. Setting Cache Paths
- Example: Caching Node.js Dependencies
- 10. Handling Cache Misses
- Example: Cache Miss Detection and Fallback
- 11. Invalidating Cache
- Example: Invalidating Cache with Key
- 12. Managing Cache Size
- Example: Configuring Cache Size in Workflow
- 13. Using Cache Across Branches
- Example: Caching Across Branches
Managing Workflow Artifacts
- 1. Uploading Artifacts
- Example: Upload a single file
- Example: Upload multiple files
- 2. Downloading Artifacts
- Example: Download a Single Artifact
- Example: Download All Artifacts
- 3. Setting Artifact Retention
- Example: Configure artifact retention in workflow
- 4. Naming Artifacts
- Example: Upload Artifact with Custom Name
- 5. Including Multiple Files
- Example: Uploading multiple files with wildcard
- 6. Excluding Files
- Example: Using exclude to filter files
- 7. Downloading Specific Artifacts
- Example: Downloading Artifact by Name
- 8. Using Artifacts Between Jobs
- Example: Using Artifacts Between Jobs
- 9. Downloading Artifacts from UI
- Example: Downloading Artifact via GitHub UI
- 10. Using Artifacts with Matrix
- Example: Matrix Artifact Upload
- 11. Compressing Artifacts
- Example: Compressing Artifacts with ZIP
- 12. Managing Artifact Storage
- Example: Upload Artifact
- Example: Download Artifact
- 13. Deleting Artifacts
- Example: Delete Artifact by ID
Working with Job Outputs
- 1. Setting Job Outputs
- Example: Setting a job output
- Example: Using job outputs in downstream jobs
- 2. Setting Output from Step
- Example: Setting a Step Output
- 3. Accessing Outputs in Dependent Jobs
- Example: Accessing Job Outputs
- 4. Using Multiline Outputs
- Example: Setting Multiline Output
- Example: Using Multiline Output in Another Job
- 5. Passing Outputs Between Jobs
- Example: Passing Outputs Between Jobs
- 6. Using Outputs in Conditions
- Example: Using job outputs in conditions
- 7. Setting Multiple Outputs
- Example: Setting Multiple Job Outputs
- 8. Using Outputs in Matrix
- Example: Using Matrix Outputs in a Subsequent Job
- 9. Debugging Output Values
- Example: Using
- 10. Handling Empty Outputs
- Example: Setting Empty Outputs
- 11. Using Outputs Across Workflows
- Example: Defining job outputs in a workflow
- Example: Using outputs in a downstream workflow
- 12. Type Casting Outputs
- Example: Casting to String
- Example: Casting to Number
- Example: Casting to Boolean
- Example: Casting to Array
- Example: Casting to Object
Implementing Concurrency Control
- 1. Setting Workflow Concurrency
- Example: Basic Concurrency Configuration
- 2. Defining Concurrency Group
- Example: Defining Concurrency Group
- 3. Canceling In-Progress Runs
- Example: Canceling in-progress runs
- 4. Using Branch-Based Concurrency
- Example: Branch Protection Rules
- Summary of Branch-Based Concurrency
- 5. Using PR-Based Concurrency
- Example: PR-Based Concurrency Configuration
- 6. Setting Job-Level Concurrency
- Example: Basic concurrency configuration
- Example: Using variables in concurrency group
- 7. Using Dynamic Concurrency Groups
- Example: Setting up a Dynamic Concurrency Group
- 8. Preventing Parallel Deployments
- Example: Using Concurrency to Prevent Parallel Deployments
- Best Practices for Concurrency Control
- 9. Queuing Workflow Runs
- Example: Configuring Concurrency
- 10. Using Actor in Concurrency
- Example: Actor Configuration
- Actor Concurrency Best Practices
- 11. Handling Concurrency with Matrix
- Example: Matrix Strategy Configuration
- 12. Monitoring Concurrent Runs
- Example: Configuring Concurrency Control
- Key Points
Managing Workflow Permissions
- 1. Setting Workflow Permissions
- Example: Setting Workflow Permissions
- 2. Using Read-Only Permissions
- Example: Using Read-Only Permissions
- 3. Using Write Permissions
- Example: Setting Write Permissions
- 4. Disabling All Permissions
- Example: Disabling all permissions
- 5. Setting Token Permissions
- Example: Setting permissions in a workflow
- 6. Configuring Contents Permission
- Example: Setting Contents Permission
- 7. Configuring Pull Request Permission
- Example: Setting PR Permissions
- 8. Configuring Issues Permission
- Example: Setting Issues Permission in Workflow
- 9. Configuring Packages Permission
- Example: Setting Package Permissions in Workflow
- 10. Configuring Deployments Permission
- Example: Setting Deployments Permission
- 11. Setting Job-Level Permissions
- Example: Setting job-level permissions
- 12. Using Minimal Permissions
- Example: Setting minimal permissions in a workflow
Working with GitHub Token
- 1. Using GITHUB_TOKEN
- Example: Using GITHUB_TOKEN to push changes
- 2. Authenticating API Requests
- Example: Using GITHUB_TOKEN to access GitHub API
- 3. Cloning Private Repositories
- Example: Cloning a Private Repo
- 4. Pushing Changes
- Example: Pushing Changes with GitHub CLI
- 5. Creating Pull Requests
- Example: Create a Pull Request
- 6. Creating Issues
- Example: Create an issue with labels and assignees
- 7. Commenting on PRs
- Example: Comment on PR
- 8. Creating Releases
- Example: Create Release with GitHub Actions
- 9. Managing Packages
- Example: Publishing to npm
- Managing Packages Summary
- 10. Using Token in Actions
- Example: Using GITHUB_TOKEN to authenticate with GitHub API
- 11. Understanding Token Scope
- Example: Using repo scope in workflow
- 12. Token Expiration
Working with Environments
- 1. Defining Environments
- Example: Environment Definition
- 2. Setting Environment Variables
- Example: Setting Environment Variables in a Job
- Example: Using Environment Variables in a Workflow
- 3. Configuring Protection Rules
- Example: Protection Rules Configuration
- 4. Setting Environment Secrets
- Example: Setting an Environment Secret
- 5. Using Environment URLs
- Example: Accessing Environment URL in a Workflow
- 6. Configuring Branch Restrictions
- Example: Branch Protection Rule
- 7. Waiting for Deployment
- Example: Waiting for a deployment to environment
- 8. Approving Deployments
- Example: Approving Deployments to Production
- Example: Configuring Approval with Conditions
- 9. Tracking Deployment Status
- Example: Using GitHub Actions to Track Deployment Status
- 10. Using Environment in Conditions
- Example: Using environment in conditions
- 11. Reviewing Deployment History
- Example: Fetch Deployment History
- 12. Deleting Environments
- Example: Delete Environment by Name
Working with Deployment Workflows
- 1. Defining Deployment Jobs
- Example: Basic Deployment Job
- 2. Using Deployment Environment
- Example: Environment Configuration
- 3. Requiring Manual Approval
- Example: Manual Approval Workflow
- 4. Setting Deployment URL
- Example: Set Deployment URL in Environment
- 5. Tracking Deployment Status
- Example: Using GitHub API to Check Deployment Status
- Example: Updating Deployment Status in GitHub Actions
- 6. Using Blue-Green Deployments
- Example: GitHub Actions Workflow for Blue-Green Deployment
- Blue-Green Deployment Benefits
- 7. Implementing Canary Deployments
- Example: Using GitHub Actions for Canary Deployment
- Key Benefits of Canary Deployments
- 8. Rolling Back Deployments
- Example: Rolling Back to Previous Commit
- 9. Using Deployment Gates
- Example: Manual Approval Gate
- Example: Environment Protection Rule
- 10. Configuring Auto-Deployments
- Example: Basic Auto-Deployment Workflow
- Example: Conditional Deployment Based on Branch
- 11. Using Deployment Notifications
- Example: Slack Notification
- 12. Monitoring Deployment History
- Example: Retrieve Deployment History
Working with Container Services
- 1. Defining Service Containers
- Example: Defining a Redis Service Container
- 2. Using PostgreSQL Service
- Example: Using PostgreSQL in a Job
- 3. Using MySQL Service
- Example: Setting up MySQL Service
- 4. Using Redis Service
- Example: Using Redis in a Workflow
- 5. Using MongoDB Service
- Example: Using MongoDB in a Workflow
- 6. Configuring Service Ports
- Example: Mapping Service Ports
- 7. Setting Service Environment Variables
- Example: Setting Environment Variables in a Service Container
- 8. Configuring Health Checks
- Example: Health Check in Dockerfile
- Example: Health Check in Compose File
- 9. Using Service Volumes
- Example: Mounting a volume to a service container
- 10. Accessing Service Containers
- Example: Accessing a Database Service
- 11. Using Multiple Services
- Example: Using Multiple Services in a Workflow
- 12. Waiting for Service Ready
- Example: Using wait-for-service in a workflow
- 13. Debugging Service Containers
- Example: Using debug logs in service containers
- Example: Inspecting container environment
- Debugging Workflow
- Debugging Methods
Creating Reusable Workflows
- 1. Defining Reusable Workflow
- Example: Defining a reusable workflow
- 2. Calling Reusable Workflows
- Example: Calling a Reusable Workflow
- 3. Passing Inputs
- Example: Using Inputs in a Workflow
- 4. Defining Input Types
- Example: Defining Inputs in a Reusable Workflow
- 5. Setting Required Inputs
- Example: Defining Required Inputs
- 6. Setting Default Input Values
- Example: Using Default Values in Workflow
- 7. Using Secrets in Reusable Workflows
- Example: Using a Secret in a Reusable Workflow
- 8. Returning Outputs
- Example: Defining Outputs in a Reusable Workflow
- Example: Using Outputs in a Calling Workflow
- 9. Accessing Caller Context
- Example: Using caller context in a reusable workflow
- 10. Nesting Reusable Workflows
- Example: Nesting Reusable Workflows
- 11. Versioning Reusable Workflows
- Example: Using Tagged Version
- 12. Sharing Across Repositories
- Example: Reusable Workflow Definition
- Example: Using the Reusable Workflow
- 13. Testing Reusable Workflows
- Example: Testing a Reusable Workflow
Building Composite Actions
- 1. Creating Composite Action
- Example: Basic Composite Action
- 2. Defining Action Inputs
- Example: Defining Inputs in action.yml
- 3. Defining Action Outputs
- Example: Defining Outputs in action.yml
- 4. Using Runs Composite
- Example: Using Runs Composite
- 5. Executing Multiple Steps
- Example: Executing Multiple Steps
- Key Points
- 6. Setting Shell for Steps
- Example: Using PowerShell on Windows
- Example: Using Python Shell
- 7. Passing Inputs to Steps
- Example: Using Inputs in a Composite Action
- 8. Setting Output Values
- Example: Setting Output Values in a Composite Action
- 9. Using Environment Variables
- Example: Setting an environment variable in a composite action
- Example: Reading an environment variable in a composite action
- 10. Handling Errors
- Example: Using continue-on-error
- Example: Handling failure with on-failure
- Error Handling Best Practices
- 11. Using Pre and Post Steps
- Example: Using pre and post steps in a composite action
- 12. Sharing Composite Actions
- Example: Using a Shared Composite Action
- 13. Versioning Composite Actions
- Example: Using a specific version in a workflow
Creating JavaScript Actions
- 1. Creating Node.js Action
- Example: Node.js Action Structure
- Example: Action Manifest (action.yml)
- 2. Defining Action Entry Point
- Example: Defining Action Entry Point
- 3. Using Actions Toolkit
- Example: Reading Inputs
- Example: Setting Outputs
- Example: Logging Messages
- Example: Using GitHub API
- 4. Getting Action Inputs
- Example: Using Inputs in a JavaScript Action
- 5. Setting Action Outputs
- Example: Setting an Output in JavaScript Action
- 6. Setting Failed Status
- Example: Setting Failed Status
- 7. Logging Messages
- Example: Using console.log in a JavaScript Action
- Example: Logging with context
- 8. Grouping Logs
- Example: Grouping Logs in a Workflow
- 9. Masking Values
- Example: Masking a Secret Value
- 10. Using GitHub API
- Example: Create a new issue using GitHub API
- 11. Compiling TypeScript
- Example: Compiling TypeScript Action
- 12. Handling Async Operations
- Example: Using async/await in a GitHub Action
- 13. Publishing to Marketplace
- Example: Publishing to Marketplace
Creating Docker Container Actions
- 1. Creating Dockerfile Action
- Example: Dockerfile Action
- Example: Dockerfile
- 2. Defining Container Image
- Example: Dockerfile for Container Action
- Example: action.yml for Container Action
- 3. Using Pre-built Images
- Example: Using a Pre-built Python Image
- 4. Building from Dockerfile
- Example: Building a Docker Action
- 5. Passing Arguments
- Example: Passing Arguments to a Docker Container Action
- 6. Setting Environment Variables
- Example: Setting environment variables in a Docker container action
- 7. Mounting Workspace
- Example: Mounting workspace to container
- 8. Using ENTRYPOINT Script
- Example: Dockerfile with ENTRYPOINT
- Example: entrypoint.sh script
- 9. Handling Action Inputs
- Example: Using Inputs in a Docker Action
- Example: Accessing Inputs in the Dockerfile
- 10. Setting Action Outputs
- Example: Setting an Output in a Docker Action
- Example: Setting Multiple Outputs
- 11. Using Docker Build Arguments
- Example: Setting Docker Build Arguments
- 12. Publishing Container Actions
- Example: Publishing a Docker Action to GitHub Container Registry
Implementing OIDC Authentication
- 1. Understanding OIDC
- Example: OIDC Token Flow
- 2. Configuring OIDC Provider
- 3. Setting ID Token Permissions
- 4. Requesting ID Token
- Example: Requesting ID Token
- 5. Configuring Trust Relationship
- 6. Using Subject Claim
- Example: Subject Claim in Token
- 7. Using Audience Claim
- Example: Audience Claim in Token
- 8. Accessing AWS with OIDC
- Example: AWS Access via OIDC
- 9. Accessing Azure with OIDC
- Example: Azure Access via OIDC
- 10. Accessing GCP with OIDC
- Example: GCP Access via OIDC
- 11. Customizing Token Claims
- 12. Validating Token
- Example: Token Validation in Node.js
- 13. Troubleshooting OIDC
- Common Issues and Solutions
- Debugging Steps
Integrating with Cloud Providers
- 1. Deploying to AWS
- Example: Deploy to AWS Lambda
- Example: Deploy to AWS ECS
- 2. Using AWS CLI
- Example: Configure AWS CLI in GitHub Actions
- Example: Upload to S3 using CLI
- 3. Deploying to Azure
- Example: Deploying a Node.js App to Azure
- 4. Using Azure CLI
- Example: Deploying a Web App
- 5. Deploying to GCP
- Example: Deploying a Docker image to GCP Cloud Run
- 6. Using GCP CLI
- Example: Authenticate and deploy to GCP
- 7. Deploying to Vercel
- Example: Basic Vercel Deployment
- Deployment Workflow Summary
- 8. Deploying to Netlify
- Example: Deploying to Netlify
- 9. Deploying to Heroku
- Example: Deploying to Heroku
- 10. Using DigitalOcean
- Example: Deploy to DigitalOcean
- 11. Using Cloudflare
- Example: Deploy to Cloudflare Workers
- Key Features
- 12. Managing Cloud Resources
- Example: Deploying to AWS EC2
- Example: Deploying to GCP Compute Engine
- Example: Deploying to Azure Virtual Machines
Working with Docker Workflows
- 1. Building Docker Images
- Example: Building and pushing a Docker image
- 2. Tagging Docker Images
- Example: Using GitHub Actions to tag Docker images with version
- 3. Pushing to Docker Hub
- Example: Pushing Docker Image to Docker Hub
- 4. Pushing to GHCR
- Example: Pushing Docker Image to GHCR
- 5. Using Docker Buildx
- Example: Setting up Buildx
- Example: Building and pushing multi-platform image
- 6. Using Multi-Stage Builds
- Example: Multi-stage Docker Build in GitHub Actions
- 7. Caching Docker Layers
- Example: Using cache action for Docker layers
- 8. Using Docker Compose
- Example: Basic docker-compose.yml
- Example: GitHub Actions workflow using Docker Compose
- 9. Running Docker Containers
- Example: Running a Docker Container
- Example: Using Custom Image with Arguments
- 10. Scanning Images for Vulnerabilities
- Example: Using Trivy to Scan Docker Images
- 11. Using Build Arguments
- Example: Setting Build Arguments in Workflow
- 12. Publishing to Multiple Registries
- Example: Publishing to Docker Hub and GHCR
Managing GitHub Packages
- 1. Publishing npm Packages
- Example: Publishing to GitHub Packages
- Example: GitHub Actions Workflow for Publishing
- 2. Publishing Docker Images
- Example: Publishing Docker Image to GHCR
- 3. Publishing Maven Packages
- Example: Publishing to GitHub Packages
- Key Steps
- 4. Publishing NuGet Packages
- Example: Publishing NuGet Package
- 5. Publishing RubyGems
- Example: Publishing a RubyGem
- 6. Authenticating to GitHub Packages
- Example: Using a Personal Access Token
- 7. Configuring Package Scope
- Example: Setting Package Scope in Workflow
- 8. Setting Package Visibility
- Example: Setting Package Visibility in Workflow
- 9. Linking Packages to Repository
- Example: Linking Package to GitHub Repository
- 10. Versioning Packages
- Example: Publishing a New Package Version
- 11. Managing Package Retention
- Example: Setting retention policy via API
- 12. Using Package Restore
- Example: Restore a package in a workflow
Implementing Testing Workflows
- 1. Running Unit Tests
- Example: Running Unit Tests with Jest
- 2. Running Integration Tests
- Example: Running Integration Tests in a Workflow
- 3. Running E2E Tests
- Example: E2E Test Workflow
- 4. Generating Test Coverage
- Example: Setting up coverage reporting with Jest
- Example: Configuring coverage thresholds
- Test Coverage Tools Comparison
- 5. Uploading Coverage Reports
- Example: Upload coverage report to Codecov
- 6. Running Linters
- Example: ESLint Configuration
- Example: Prettier Configuration
- Workflow Steps for Linting
- 7. Running Code Formatters
- Example: Prettier in GitHub Actions
- 8. Running Type Checkers
- Example: Running TypeScript Checks in GitHub Actions
- 9. Using Test Reporters
- Example: Using JUnit Reporter
- 10. Failing on Low Coverage
- Example: Configuring Coverage Failures
- 11. Running Tests in Parallel
- Example: Parallel Test Jobs
- Best Practices for Parallel Testing
- 12. Using Test Fixtures
- Example: Setting Up a Test Fixture
Implementing Code Quality Workflows
- 1. Running CodeQL Analysis
- Example: Running CodeQL Analysis
- Key Points
- 2. Using SonarCloud
- Example: SonarCloud Analysis
- Key Features
- 3. Using ESLint
- Example: ESLint Configuration
- Example: GitHub Action Workflow
- 4. Using Prettier
- Example: Format JavaScript files with Prettier
- Example: GitHub Actions workflow using Prettier
- 5. Using Dependency Scanning
- Example: Snyk Dependency Scan
- Example: OWASP Dependency Check
- 6. Scanning for Secrets
- Example: Secret Scanning Workflow
- 7. Running Security Audits
- Example: Security Audit Workflow
- 8. Using License Checkers
- Example: Using licensee in GitHub Actions
- 9. Generating Code Metrics
- Example: Setting up Code Coverage with Jest
- Example: Using Codecov to Upload Coverage Reports
- 10. Creating Quality Gates
- Example: Basic Quality Gate Workflow
- Quality Gate vs. Continuous Integration
- 11. Commenting on PRs
- Example: Comment on PR with linting results
- 12. Using Pre-commit Hooks
- Example: Setting up pre-commit hooks in GitHub Actions
Implementing Security Best Practices
- 1. Pinning Action Versions
- Example: Using SHA for Pinning
- 2. Using Verified Actions
- Example: Using a Verified Action
- 3. Reviewing Third-Party Actions
- Example: Pinning Action Version
- Best Practices for Action Review
- 4. Limiting Workflow Permissions
- Example: Setting minimal permissions for a workflow
- 5. Using Environment Secrets
- Example: Using Environment Secrets in a Workflow
- 6. Preventing Script Injection
- Example: Secure Command Execution
- Example: Input Validation in Workflow
- 7. Using CodeQL Analysis
- Example: Basic CodeQL workflow configuration
- CodeQL Analysis Workflow Steps
- CodeQL vs Other Static Analysis Tools
- 8. Scanning Dependencies
- Example: GitHub Dependabot Configuration
- Example: Snyk Configuration
- 9. Using Secret Scanning
- Example: Enabling Secret Scanning in a Workflow
- 10. Implementing Branch Protection
- Example: GitHub Actions Workflow with Branch Protection
- 11. Restricting Workflow Triggers
- Example: Restricting Push Triggers
- Example: Restricting Pull Request Triggers
- 12. Using Audit Logs
- Example: Enabling audit logging for GitHub Actions
- Key Points About Audit Logs
- 13. Rotating Credentials
- Example: Rotating GitHub PAT in Workflow
Handling Errors and Debugging
- 1. Enabling Debug Logging
- Example: Setting debug environment variables
- 2. Enabling Runner Diagnostics
- Example: Enabling debug logging in a workflow
- Summary of Diagnostic Logging
- 3. Using Continue on Error
- Example: Using continue-on-error in a job step
- 4. Checking Step Outcome
- Example: Using step outcome in conditional logic
- 5. Using Failure Conditions
- Example: Using
- 6. Logging Debug Messages
- Example: Using debug logging in a job
- 7. Logging Warning Messages
- Example: Using Warning Messages in a Workflow
- 8. Logging Error Messages
- 9. Creating Annotations
- Example: Creating a Warning Annotation
- 10. Using SSH Debugging
- Example: SSH into a GitHub Actions Runner
- SSH Debugging Workflow
- 11. Inspecting Workflow Files
- Example: Basic Workflow File Structure
- 12. Validating Workflow Syntax
- Example: Using act to validate workflow syntax
- 13. Testing Workflows Locally
- Example: Using act to test workflows locally
Working with Workflow Annotations
- 1. Creating Error Annotations
- Example: Using GitHub Actions Error Annotations
- Example: Annotating with Custom Message
- 2. Creating Warning Annotations
- Example: Creating a Warning Annotation
- 3. Creating Notice Annotations
- Example: Creating a Notice Annotation
- 4. Setting Annotation File
- Example: Setting Annotation File
- 5. Setting Annotation Line
- Example: Setting Line Numbers in Annotations
- 6. Setting Annotation Column
- Example: Setting Annotation Column
- 7. Setting Annotation Title
- Example: Setting Annotation Title
- 8. Using Problem Matchers
- Example: Using Problem Matchers in a Workflow
- 9. Defining Custom Problem Matchers
- Example: Defining a Custom Problem Matcher
- 10. Registering Problem Matchers
- Example: Registering a Problem Matcher
- 11. Removing Problem Matchers
- Example: Removing a Problem Matcher
- 12. Viewing Annotations
- Example: Using Annotations in a Workflow
- Key Points
Optimizing Workflow Performance
- 1. Using Caching Effectively
- Example: Caching Node.js Dependencies
- Example: Caching with Multiple Paths
- Best Practices for Caching
- 2. Parallelizing Jobs
- Example: Running Jobs in Parallel
- Best Practices for Parallel Jobs
- 3. Reducing Checkout Depth
- Example: Fetch only the last 1 commit
- 4. Using Sparse Checkout
- Example: Setting up sparse checkout
- 5. Minimizing Docker Layers
- Example: Optimized Dockerfile Layering
- 6. Using Matrix Efficiently
- Example: Efficient Matrix Usage
- Best Practices for Matrix Usage
- 7. Skipping CI
- Example: Skip CI with commit message
- How It Works
- 8. Using Conditionals
- Example: Conditional Step Execution
- Example: Conditional on Event Type
- 9. Caching Docker Layers
- Example: Caching Docker layers in a workflow
- 10. Using Prebuilt Actions
- Example: Using a prebuilt action to checkout code
- Example: Using a prebuilt action with inputs
- Benefits of Using Prebuilt Actions
- 11. Optimizing Runner Selection
- Example: Using specific runner
- Best Practices
- 12. Monitoring Workflow Duration
- Example: Using GitHub Actions API to fetch workflow duration
- 13. Using Workflow Templates
- Example: Reusing a workflow template
Working with Workflow Summaries
- 1. Creating Job Summaries
- Example: Basic Job Summary
- Key Points
- 2. Using Markdown in Summaries
- Example: Basic Markdown in Workflow Summary
- 3. Adding Tables to Summaries
- Example: Creating a Table in Workflow Summary
- 4. Adding Images to Summaries
- Example: Embedding Image in Workflow Summary
- 5. Adding Code Blocks to Summaries
- Example: Using
- 6. Adding Collapsible Sections
- Example: Using HTML in Workflow Summary
- 7. Adding Links to Summaries
- Example: Adding a Link to Summary
- 8. Formatting with Emojis
- Example: Using Emojis in Job Logs
- 9. Appending Multiple Summaries
- Example: Appending Multiple Summaries
- 10. Using Summary Actions
- Example: Writing a Summary
- 11. Generating Test Result Summaries
- Example: Publishing Test Results
- Key Features
- 12. Creating Build Status Summaries
- Example: Basic Build Status Summary
Using Advanced Workflow Features
- 1. Creating Workflow Templates
- Example: Basic workflow template structure
- Template Best Practices
- 2. Implementing Workflow Dispatch Inputs
- Example: Workflow Dispatch with Inputs
- 3. Using Repository Dispatch
- Example: Triggering a Workflow via Repository Dispatch
- Example: Sending a Repository Dispatch Event via API
- 4. Integrating with GitHub Apps
- Example: Using GitHub App for CI/CD
- Key Points
- 5. Using Workflow Run API
- Example: Fetching Workflow Run Details
- Example: Triggering a Workflow Run
- 6. Monitoring Workflow Quotas
- Example: Checking Workflow Quotas via API
- 7. Using Workflow Visualization
- Example: Viewing Workflow Graph
- Key Features
- 8. Creating Rerun Logic
- Example: Basic rerun logic with manual trigger
- Example: Conditional rerun based on job status
- Key Concepts for Rerun Logic
- 9. Implementing Approval Gates
- Example: Manual Approval for Production Deployment
- Key Points
- 10. Using Required Workflows
- Example: Requiring Workflows in a GitHub Action
- 11. Handling Workflow Timeouts
- Example: Setting a Custom Timeout
- 12. Implementing Retry Mechanisms
- Example: Retry Configuration
Working with Workflow Status Badges
- 1. Creating Status Badges
- Example: Adding a Build Status Badge to README.md
- 2. Using Branch Specific Badges
- Example: Branch-specific Badge URL
- 3. Using Event Specific Badges
- Example: Embedding a Push-Specific Badge
- 4. Embedding in README
- Example: Embedding Workflow Badge
- 5. Customizing Badge Style
- Example: Custom Badge Style
- 6. Using Multiple Badges
- Example: Displaying Multiple Workflow Status Badges
- 7. Creating Dynamic Badges
- Example: Using a Dynamic Badge in README
- 8. Showing Build Status
- Example: Adding a workflow status badge to README
- Badge Configuration Options
- 9. Using Coverage Badges
- Example: Setting up a coverage badge
- 10. Creating Custom Badges
- Example: Basic Badge Configuration
- Badge Configuration Summary
- 11. Adding Badge Tooltips
- Example: Adding Tooltip to Badge
- 12. Linking Badges to Workflows
- Example: Linking Badge to Workflow
Using GitHub CLI in Workflows
- 1. Using gh auth
- Example: Authenticating with gh auth login
- Example: Retrieving the authentication token
- 2. Using gh pr Commands
- 3. Using gh issue Commands
- 4. Using gh release Commands
- Example: Create a Release
- Example: Upload Assets to Release
- 5. Using gh repo Commands
- Example: Clone a repository
- Example: Create a new repository
- 6. Using gh run Commands
- Example: List recent workflow runs
- Example: View a specific run
- Example: Cancel a running run
- 7. Using gh workflow Commands
- 8. Using gh api Commands
- Example: Fetching Issues from a Repository
- Example: Creating a New Issue
- 9. Formatting gh Output
- Example: Using JSON format to parse output
- Example: Using table format for readable output
- 10. Using gh Extensions
- Example: Installing and Using a GitHub CLI Extension
- 11. Automating with gh Scripts
- Example: Running a Script
- Example: Creating a Script
- 12. Authenticating gh
- Example: Using a Personal Access Token
Configuring Dependabot Integration
- 1. Enabling Dependabot Updates
- Example: Enabling Dependabot in GitHub Actions
- 2. Configuring Update Schedule
- Example: Daily Updates
- Example: Weekly Updates on Monday
- 3. Setting Target Branch
- Example: Setting Target Branch in Workflow
- 4. Limiting Open PRs
- Example: Configuring Open PR Limit
- 5. Grouping Updates
- Example: Grouping Updates in Dependabot Configuration
- 6. Ignoring Dependencies
- Example: dependabot.yml configuration
- 7. Using Version Constraints
- Example: Setting Version Constraints in Dependabot Configuration
- 8. Configuring PR Reviewers
- Example: Basic PR Reviewer Configuration
- 9. Setting Commit Message Format
- Example: Configuring Commit Message Format
- 10. Handling Security Updates
- Example: Enable Security Updates
- 11. Auto-Merging Dependabot PRs
- Example: Enabling Auto-Merge for Dependabot
- 12. Managing Dependabot Secrets
- Example: Using Dependabot Secrets in a Workflow
Managing Organization Workflows
- 1. Creating Organization Starter Workflows
- Example: Creating a Starter Workflow
- 2. Sharing Reusable Workflows
- Example: Using a Reusable Workflow
- Key Points
- 3. Setting Required Workflows
- Example: Configuring Required Workflows
- 4. Using Organization Secrets
- Example: Using Organization Secret in a Workflow
- 5. Managing Runner Groups
- Example: Create a Runner Group
- Example: Update Runner Group
- 6. Configuring Organization Policies
- Example: Setting workflow permissions
- 7. Setting Allowed Actions
- Example: Configure allowed actions in organization settings
- 8. Using Private Actions
- Example: Using a Private Action
- 9. Auditing Workflow Usage
- Example: Viewing Workflow Audit Logs
- 10. Managing Billing
- Example: Setting up Billing for Organization
- 11. Configuring Default Permissions
- Example: Setting Default Permissions in a Workflow
- 12. Using Enterprise Features
- Example: Using Custom Actions in Enterprise
- Enterprise Features Overview
Integrating with External Services
- 1. Using Slack Notifications
- Example: Slack Notification Configuration
- Summary of Slack Integration
- 2. Using Email Notifications
- Example: Configure Email Notification
- 3. Using Discord Webhooks
- Example: Sending a Discord Webhook
- 4. Using Microsoft Teams
- Example: Send a message to Microsoft Teams
- 5. Integrating with Jira
- Example: Create Jira Issue
- Jira Integration Capabilities
- 6. Using Kubernetes
- Example: Deploying to Kubernetes
- Key Concepts
- 7. Using Terraform
- Example: Setup Terraform
- Example: Run Terraform Plan
- 8. Using Ansible
- Example: Running an Ansible Playbook
- 9. Using Datadog
- Example: Setting up Datadog tracing in a workflow
- 10. Using New Relic
- Example: Using New Relic Action
- 11. Posting to Twitter
- Example: Posting a Status Update
- 12. Integrating with PagerDuty
- Example: Send Alert to PagerDuty
Monitoring and Analytics
- 1. Viewing Workflow Runs
- Example: Fetching workflow run details via API
- 2. Checking Job Status
- Example: Using job status in a workflow
- 3. Viewing Job Logs
- Example: Accessing Job Logs
- 4. Downloading Workflow Logs
- Example: Downloading Logs via CLI
- 5. Using Workflow Insights
- Example: Accessing Workflow Insights
- Key Features of Workflow Insights
- 6. Monitoring Runner Usage
- Example: Using runner labels in workflow
- 7. Tracking Workflow Duration
- Example: Calculate Workflow Duration
- 8. Viewing Workflow Dependencies
- Example: Reusable Workflow Call
- Key Points
- 9. Using Workflow API
- Example: Fetching Workflow Runs
- Example: Getting Workflow Run Details
- 10. Setting Up Alerts
- Example: Basic Alert Configuration
- 11. Analyzing Billing Usage
- Example: Billing Usage Query
- 12. Creating Custom Dashboards
- Example: Setting up a custom dashboard with GitHub Actions metrics
- Comparison: GitHub Actions vs External Dashboard Tools
Migrating from Other CI/CD
- 1. Migrating from Jenkins
- Example: Migrating a Jenkins Pipeline Stage to GitHub Actions
- Migration Steps Overview
- Jenkins vs GitHub Actions
- 2. Migrating from Travis CI
- Example: Migrating a Travis CI job to GitHub Actions
- Travis CI vs GitHub Actions
- 3. Migrating from CircleCI
- CircleCI vs GitHub Actions
- Example: Migrating a CircleCI Job to GitHub Actions
- Migration Steps
- 4. Migrating from GitLab CI
- Key Differences: GitHub Actions vs GitLab CI
- Example: Migrating a Simple Build Job
- Migration Steps Overview
- 5. Migrating from Azure Pipelines
- Example: Migrating a Simple Pipeline
- Key Differences
- 6. Converting Pipeline Stages
- Example: Converting a Build Stage
- Example: Converting a Test Stage
- Example: Converting a Deploy Stage
- 7. Converting Build Steps
- Example: Converting npm install and build steps
- 8. Migrating Environment Variables
- Example: Setting Environment Variables in GitHub Actions
- 9. Converting Caching Logic
- Example: CircleCI to GitHub Actions Caching
- 10. Migrating Artifacts
- Example: Upload Build Artifacts
- Example: Download Artifacts
- 11. Converting Matrix Builds
- Example: Matrix Build Configuration
- Example: Including Custom Matrix Entry
- 12. Migrating Deployment Scripts
- Example: Migrating a Deployment Script
- 13. Testing Migrated Workflows
- Example: Basic workflow test
- Testing Migration Steps
- Migration Testing vs Manual Testing