Interview Prep/GitHub Actions/Triggers & Events

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 (with paths if it is a monorepo).
  • Nightly scan: schedule plus workflow_dispatch so it can be run on demand.
  • DB migration: workflow_dispatch with an environment input, 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. Use workflow_run only when the workflows must stay separate, and check github.event.workflow_run.conclusion == 'success' and head_branch.
All GitHub Actions questions Roadmap: GitHub Actions

More on Triggers & Events