Adding workflow_dispatch
This lesson preview is part of the Bundling and Automation in Monorepos course and can be unlocked immediately with a \newline Pro subscription or a single-time purchase. Already have access to this course? Log in here.
Get unlimited access to Bundling and Automation in Monorepos, plus 90+ \newline books, guides and courses with the \newline Pro subscription.

[00:00 - 00:09] What we're going to do in this lesson is add an option to our workflow to run it manually. I'm going to open our .github/workflows/ci.yaml file.
[00:10 - 00:18] And then in the list of triggers I'm going to add "workflow_dispatch:". It doesn't need any options.
[00:19 - 00:33] So let me create a branch: add-workflow-dispatch. Add all changes. Commit this as "Add workflow dispatch to CI workflow".
[00:34 - 00:55] Push this to origin/add-workflow-dispatch and create a pull request. We can now merge this pull request into our main branch and once it has been merged, we can go to actions, select our CI workflow.
[00:56 - 01:09] And now we have the option to run it with Workflow Dispatch event trigger. In the case where you don't have any arguments, we can directly just run the workflow for a given branch like this.
[01:10 - 01:32] It's a good idea to set up your GitHub action workflows with workflow dispatch, because it makes debugging and experimenting much easier. It is worth noting that for more complicated workflows that have inputs, you would now have the option to select those inputs in this window over here.
[01:33 - 01:40] The workflow dispatch form. We're not going to get into that because that's advanced usage of GitHub actions.
[01:41 - 01:51] But just being aware that it's a possibility is very valuable. And you can look into the possible form options you can create here on your own time.
[01:52 - 01:55] That's everything for this lesson. And I'll see you in the next one.