By default, GitHub Actions does not allow you to run a workflow manually. In order to enable manual workflow runs, I had to add workflow_dispatch to the YAML file under .github/workflows/.

For example, the beginning of my GitHub Actions YAML file looked like this:

1
2
3
4
5
name: Deploy
on:
  push:
    branches:
      - master

This configuration allows for workflows to run on commit pushes to the master branch, but there is no option to run this workflow manually on GitHub:

GitHub Actions doesn't show a manual way of running the workflow.

To enable manual runs of workflows, I added the workflow_dispatch key. There was no need to add anything else under it:

1
2
3
4
5
6
name: Deploy
on:
  push:
    branches:
      - master
  workflow_dispatch:

After pushing changes, I was able to see a “Run workflow” button that allows me to run the workflow manually.

GitHub Actions now shows a manual way of running the workflow.

Note that there are a lot more configuration options available when adding the workflow_dispatch key. However, I just wanted to enable manual runs and nothing more. Refer to the documentation for more information.

References