⚙️ Playwright Essentials #80 GitHub Actions: Workflow Dispatch + Environment Variables
In this episode, we dive into advanced GitHub Actions features—specifically workflow_dispatch for manual triggers and env configuration for dynamic builds. Whether you're running Playwright tests, deploying TypeScript apps, or managing multi-environment pipelines, this setup gives you full control over when and how your workflows run.
🎯 What You’ll Learn:
🚀 Triggering Workflows Manually with workflow_dispatch
Enable manual execution from the GitHub UI
Add input parameters for runtime flexibility
Example on block:
on:
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
required: true
default: 'staging'
Trigger from GitHub → Actions → Select workflow → Click Run workflow
🌍 Using env for Environment Variables
Define global or job-level environment variables
Inject secrets securely via GitHub repository settings
Example usage:
env:
NODE_ENV: ${{ github.event.inputs.environment }}
API_KEY: ${{ secrets.API_KEY }}
Use variables in steps to customize behavior
name: Run Tests
run: npm run test -- --env $NODE_ENV
🧪 Real-World Use Cases
Manually trigger Playwright tests for staging, prod, or debug
Pass custom flags like TEST_SUITE=smoke or DEBUG=true
Run security scans or deployments on demand
Create reusable workflows for QA, Dev, and Ops teams
#GitHubActions #workflow_dispatch #CIWorkflow #DevSecOps #TypeScriptEssentials #QAEngineer #WebAutomation #SDET #PlaywrightTesting #SecureCoding