Which trigger would you choose for each: lint on PRs, nightly dependency scan, on-demand DB migration, deploy after CI passes in another workflow?
IntermediateConceptTriggers & Events
Answer
- Lint on PRs:
pull_request(withpathsif it is a monorepo). - Nightly scan:
scheduleplusworkflow_dispatchso it can be run on demand. - DB migration:
workflow_dispatchwith anenvironmentinput, and the job bound to that environment for approval. - Deploy after CI: better to make deploy a job in the same workflow with
needs, or call a reusable workflow. Useworkflow_runonly when the workflows must stay separate, and checkgithub.event.workflow_run.conclusion == 'success'andhead_branch.
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