Interview Prep/GitHub Actions/Pipeline Design & Triggers

A nightly security scan should run at 02:00 India time on weekdays and also be runnable on demand. Write it.

BeginnerScenarioPipeline Design & Triggers
Answer

Situation read → Cron is UTC; IST is UTC+5:30.

What I'd do →

  1. Convert: 02:00 IST is 20:30 UTC the previous day, so weekdays Monday to Friday IST map to Sunday to Thursday UTC:
    on:
      schedule:
        - cron: "30 20 * * 0-4"
      workflow_dispatch:
    
  2. Guard against forks: if: github.repository == 'devopsshack/shack-api'.
  3. Notify on failure only (if: failure()).

Why → The day-of-week shift is the classic mistake when converting to UTC.

Interview tip → Mention that schedules are best-effort and can be delayed at peak load, so do not use them for time-critical jobs.

All GitHub Actions questions Roadmap: GitHub Actions

More on Pipeline Design & Triggers