AI Hints
Home›CI/CD with GitHub Actions Tutorial›Filters, Manual and Scheduled Runs
CI/CD with GitHub Actions · Lesson 32 of 138

Manual Runs

Workflow_dispatch.

⏱ 2 min read▶ Video at 36:04🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

Sometimes you want a button. Run the release now. Rebuild the docs. Clean up old files. The workflow dispatch event adds a Run workflow button on GitHub, with optional inputs, like a little form.

Manual Runs
From the video: Manual Runs
  • Sometimes you want a button
  • Release now, clean up
  • workflow_dispatch

A button with inputs

Workflow dispatch can take inputs. Here, a choice of environment, with staging as the default, and a true or false option for a dry run. GitHub shows these as a dropdown and a checkbox. Inside the steps, you read them with inputs dot, and the input's name.

.github/workflows/deploy.ymlyaml
name: Deploy
on:
  workflow_dispatch:
    inputs:
      environment:
        type: choice
        options: [staging, production]
        default: staging
      dry_run:
        type: boolean
        default: true
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Deploying to ${{ inputs.environment }}"

Where manual runs help

Manual runs are great for deployments that a person should decide on, for one off maintenance jobs, and for re running something with different settings. You can also start them from the command line, with the GH tool, using GH workflow run, which is handy for scripts.

keyvalue
Run workflowa button on GitHub
inputs:a small form
gh workflow runfrom the terminal
Good fordeploys, maintenance

Summary

Workflow dispatch adds a Run button, with inputs you read using inputs dot name. Next, running workflows on a schedule.

Key takeaways
  • on: workflow_dispatch
  • inputs: choice, boolean
  • ${{ inputs.name }}
Next up: Scheduled Runs — cron in the cloud