Git & GitHub Interview Question #107

What is workflow_dispatch in GitHub Actions?

Advanced GitHub Actions, Repository Internals, Submodules, LFS & Diagnostic Tools Senior Advanced

Quick Interview Answer

workflow_dispatch is an event that allows a workflow to be started manually. It can define inputs so the person starting the workflow can choose values such as an environment or deployment mode.

Detailed Explanation

workflow_dispatch is an event that allows a workflow to be started manually. It can define inputs so the person starting the workflow can choose values such as an environment or deployment mode.

Manual dispatch is useful for controlled maintenance, release, or deployment workflows that should not run on every push.

Code Example

on:
  workflow_dispatch:
    inputs:
      environment:
        description: Deployment environment
        required: true
        type: choice
        options:
          - staging
          - production