Pushing to a PR branch runs CI twice (once for push, once for pull_request). How do you fix it?
BeginnerScenarioPipeline Design & Triggers
Answer
Situation read → on: [push, pull_request] with no branch filters fires both events for every commit on a PR branch.
What I'd do →
- Restrict
pushto long-lived branches and let PRs cover feature branches:on: push: branches: [main, "release/**"] pull_request: - Add
concurrencykeyed on PR number or ref so leftovers cancel.
Why → Halves CI minutes for feature work while still validating main after merge.
Interview tip → Mention that pull_request tests the merge commit, which is more valuable than testing the branch head alone.
More on Pipeline Design & Triggers
You join a team whose single 900-line workflow runs everything on every push to every branch. How do you restructure it?IntermediateProduct wants a "Deploy to staging" button that lets QA pick a version. Design it.BeginnerA nightly security scan should run at 02:00 India time on weekdays and also be runnable on demand. Write it.BeginnerYour team wants preview environments per PR on EKS, destroyed when the PR closes. Design the workflow.AdvancedTwo workflows must run in sequence: CI then a separate deploy workflow owned by another team. How do you link them?IntermediateA merge queue is enabled, but PRs sit in the queue forever. What is your design fix?Intermediate