🏁 manually trigger github actions
Most GitHub Actions run automatically when things happen in the repository. Events like pushes, pull requests, issues, forks, and releases are the most common. But if you've ever wanted to kick off a workflow manually, that is also supported.
To enable a workflow to be run manually, add the
workflow_dispatch entry to the
on property. As a result, your action will now have a Run workflow button as shown below.
name: "🏁 manually triggered workflow" on: workflow_dispatch
Some actions require inputs, so manually triggered workflows also have the ability to accept inputs. Inputs can be added by adding an
inputs entry underneath the
workflow_dispatch property. Each input has a key, which is mapped directly to the input context. They also have a few other nested properties as shown below.
name: "🏁 manually triggered workflow" on: workflow_dispatch: inputs: firstName: description: "Your first name" type: string default: Brad required: true
Now the Run workflow button on your action will show a dialog with all of the inputs listed for you to fill out manually before triggering the run.
As an added bonus, the GitHub CLI also supports workflow commands. Workflows can be viewed, started, and monitored from your terminal. Use the command below to manually trigger a workflow from the CLI. It walks you through selecting the workflow and adding inputs.
gh workflow run
For more information about manually triggering workflows, check the documentation or hit me up on Twitter!