Interview Prep/GitHub Actions/Triggers & Events

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).

All GitHub Actions questions Roadmap: GitHub Actions

More on Triggers & Events