How does a reusable workflow get triggered, and can it also be triggered directly?
BeginnerConceptTriggers & Events
Answer
on: workflow_call makes it callable from other workflows at job level. You can combine triggers so the same file also runs on its own:
on:
workflow_call:
inputs:
environment: { type: string, required: true }
workflow_dispatch:
inputs:
environment: { type: environment, required: true }
Inside, inputs.environment works for both triggers, and github.event_name tells you which one fired (for a call it reports the caller's event).
More on Triggers & Events
How do you trigger a workflow on pushes to `main` and on PRs that target `main`?BeginnerWhat activity types does `pull_request` trigger on by default, and how do you add more?IntermediateHow do `branches` and `branches-ignore` filters work with globs?BeginnerHow do path filters work, and what are their limits?AdvancedHow do you trigger only on version tags, and what is the gotcha with pushing many tags?IntermediateWhat is `workflow_dispatch`, and what input types does it support?Beginner